Quellcode der Dragonslayer-Edition
Quellcode der Dragonslayer-Edition : 0.9.7(Dragonslayer Edition V/3)


Anmerkung: Dies ist nur ein Auszug aus dem Source. Ein etwas älteres, abgespecktes Release ist für jeden Interessenten frei zum Download verfügbar. Allerdings würden wir uns über eine Anfrage freuen, in der die Serveradresse bzw. sonstiger Verwendungszweck aufgeführt sind, da wir gern wissen würden wohin unsere Version geht. Was wir uns unbedingt verbitten, ist Diebstahl unserer Arbeit ohne Nennung des Copyrights.
Falls beim Lesen des Source ein Bug entdeckt werden sollte, bitten wir um sofortige Meldung per Anfrage!


./pvparena.php

zurück
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
656:
657:
658:
659:
660:
661:
662:
663:
664:
665:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:
713:
714:
715:
716:
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739:
740:
741:
742:
743:
744:
745:
746:
747:
748:
749:
750:
751:
752:
753:
754:
755:
756:
757:
758:
759:
760:
761:
762:
763:
764:
765:
766:
767:
768:
769:
770:
771:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784:
785:
786:
787:
788:
789:
790:
791:
792:
793:
794:
795:
796:
797:
798:
799:
800:
801:
802:
803:
804:
805:
806:
807:
808:
809:
810:
811:
812:
813:
814:
815:
816:
817:
818:
819:
820:
821:
822:
823:
824:
825:
826:
827:
828:
829:
830:
831:
832:
833:
834:
835:
836:
837:
838:
839:
840:
841:
842:
843:
844:
845:
846:
847:
848:
849:
850:
851:
852:
853:
854:
855:
856:
857:
858:
859:
860:
861:
862:
863:
864:
865:
866:
867:
868:
869:
870:
871:
872:
873:
874:
875:
876:
877:
878:
879:
880:
881:
882:
883:
884:
885:
886:
887:
888:
889:
890:
891:
892:
893:
894:
895:
896:
897:
898:
899:
900:
901:
902:
903:
904:
905:
906:
907:
908:
909:
910:
911:
912:
913:
914:
915:
916:
917:
918:
919:
920:
921:
922:
923:
924:
925:
926:
927:
928:
929:
930:
931:
932:
933:
934:
935:
936:
937:
938:
939:
940:
941:
942:
943:
944:
945:
946:
947:
948:
949:
950:
951:
952:
953:
954:
955:
956:
957:
958:
959:
960:
961:
962:
963:
964:
965:
966:
967:
968:
969:
970:
971:
972:
973:
974:
975:
976:
977:
978:
979:
980:
981:
982:
983:
984:
985:
986:
987:
988:
989:
990:
991:
992:
993:
994:
995:
996:
997:
998:
999:
1000:
1001:
1002:
1003:
1004:
1005:
1006:
1007:
1008:
1009:
1010:
1011:
1012:
1013:
1014:
1015:
1016:
1017:
1018:
1019:
1020:
1021:
1022:
1023:
1024:
1025:
1026:
1027:
1028:
1029:
1030:
1031:
1032:
1033:
1034:
1035:
1036:
1037:
1038:
1039:
1040:
1041:
1042:
1043:
1044:
1045:
1046:
1047:
1048:
1049:
1050:
1051:
1052:
1053:
1054:
1055:
1056:
1057:
1058:
1059:
1060:
1061:
1062:
1063:
1064:
1065:
1066:
1067:
1068:
1069:
1070:
1071:
1072:
1073:
1074:
1075:
1076:
1077:
1078:
1079:
1080:
1081:
1082:
1083:
1084:
1085:
1086:
1087:
1088:
1089:
1090:
1091:
1092:
1093:
1094:
1095:
1096:
1097:
1098:
1099:
1100:
1101:
1102:
1103:
1104:
1105:
1106:
1107:
1108:
1109:
1110:
1111:
1112:
1113:
1114:
1115:
1116:
1117:
1118:
1119:
1120:
1121:
1122:
1123:
1124:
1125:
1126:
1127:
1128:
1129:
1130:
1131:
1132:
1133:
1134:
1135:
1136:
1137:
1138:
1139:
1140:
1141:
1142:
1143:
1144:
1145:
1146:
1147:
1148:
1149:
1150:
1151:
1152:
1153:
1154:
1155:
1156:
1157:
1158:
1159:
1160:
1161:
1162:
1163:
1164:
1165:
1166:
1167:
1168:
1169:
1170:
1171:
1172:
1173:
1174:
1175:
1176:
1177:
1178:
1179:
1180:
1181:
1182:
1183:
1184:
1185:
1186:
1187:
1188:
1189:
1190:
1191:
1192:
1193:
1194:
1195:
1196:
1197:
1198:
1199:
1200:
1201:
1202:
1203:
1204:
1205:
1206:
1207:
1208:
1209:
1210:
1211:
1212:
1213:
1214:
1215:
1216:
1217:
1218:
1219:
1220:
1221:
1222:
1223:
1224:
1225:
1226:
1227:
1228:
1229:
1230:
1231:
1232:
1233:
1234:
1235:
1236:
1237:
1238:
1239:
1240:
1241:
1242:
1243:
1244:
1245:
1246:
1247:
1248:
1249:
1250:
1251:
1252:
1253:
1254:
1255:
1256:
1257:
1258:
1259:
1260:
1261:
1262:
1263:
1264:
1265:
1266:
1267:
1268:
1269:
1270:
1271:
1272:
1273:
1274:
1275:
1276:
1277:
1278:
1279:
1280:
1281:
1282:
1283:
1284:
1285:
1286:
1287:
1288:
1289:
1290:
1291:
1292:
1293:
1294:
1295:
1296:
1297:
1298:
1299:
1300:
1301:
1302:
1303:
1304:
1305:
1306:
1307:
1308:
1309:
1310:
1311:
1312:
1313:
1314:
1315:
1316:
1317:
1318:
1319:
1320:
1321:
1322:
1323:
1324:
1325:
1326:
1327:
1328:
1329:
1330:
1331:
1332:
1333:
1334:
1335:
1336:
1337:
1338:
1339:
1340:
1341:
1342:
1343:
1344:
1345:
1346:
1347:
1348:
1349:
1350:
1351:
1352:
1353:
1354:
1355:
1356:
1357:
1358:
1359:
1360:
1361:
1362:
1363:
1364:
1365:
1366:
1367:
1368:
1369:
1370:
1371:
1372:
1373:
1374:
1375:
1376:
1377:
1378:
1379:
1380:
1381:
1382:
1383:
1384:
1385:
1386:
1387:
1388:
1389:
1390:
1391:
1392:
1393:
1394:
1395:
1396:
1397:
1398:
1399:
1400:
1401:
1402:
1403:
1404:
1405:
1406:
1407:
1408:
1409:
1410:
1411:
1412:
1413:
1414:
1415:
1416:
1417:
1418:
1419:
1420:
1421:
1422:
1423:
1424:
1425:
1426:
1427:
1428:
1429:
1430:
1431:
1432:
1433:
1434:
1435:
1436:
1437:
1438:
1439:
1440:
1441:
1442:
1443:
1444:
1445:
1446:
1447:
1448:
1449:
1450:
1451:
1452:
1453:
1454:
1455:
1456:
1457:
1458:
1459:
1460:
1461:
1462:
1463:
1464:
1465:
1466:
1467:
1468:
1469:
1470:
1471:
1472:
1473:
1474:
1475:
1476:
1477:
1478:
1479:
1480:
1481:
1482:
1483:
1484:
1485:
1486:
1487:
1488:
1489:
1490:
1491:
1492:
1493:
1494:
1495:
1496:
1497:
1498:
1499:
1500:
1501:
1502:
1503:
1504:
1505:
1506:
1507:
1508:
1509:
1510:
1511:
1512:
1513:
1514:
1515:
1516:
1517:
1518:
1519:
1520:
1521:
1522:
1523:
1524:
1525:
1526:
1527:
1528:
1529:
1530:
1531:
1532:
1533:
1534:
1535:
1536:
1537:
1538:
1539:
1540:
1541:
1542:
1543:
1544:
1545:
1546:
1547:
1548:
1549:
1550:
1551:
1552:
1553:
1554:
1555:
1556:
1557:
1558:
1559:
1560:
1561:
1562:
1563:
1564:
1565:
1566:
1567:
1568:
1569:
1570:
1571:
1572:
1573:
1574:
1575:
1576:
1577:
1578:
1579:
1580:
1581:
1582:
1583:
1584:
1585:
1586:
1587:
1588:
1589:
1590:
1591:
1592:
1593:
1594:
1595:
1596:
1597:
1598:
1599:
1600:
1601:
1602:
1603:
1604:
1605:
1606:
1607:
1608:
1609:
1610:
1611:
1612:
1613:
1614:
1615:
1616:
1617:
1618:
1619:
1620:
1621:
1622:
1623:
1624:
1625:
1626:
1627:
1628:
1629:
1630:
1631:
1632:
1633:
1634:
1635:
1636:
1637:
1638:
1639:
1640:
1641:
1642:
1643:
1644:
1645:
1646:
1647:
1648:
1649:
1650:
1651:
1652:
1653:
1654:
1655:
1656:
1657:
1658:
<?php

// 24072004

/*****************************************************
PvP-Arena by anpera 2004

For "Legend of the Green Dragon" 0.9.7 by Eric Stevens

This gives players the possibility to fight against other players with all
their specialties, mounts and buffs. The first non-automated PvP
system for LoGD that comes pretty close to real online PvP. :)

(Quite rough by now but Im still working on it.)

Fully compatible with lonnyl's battle-arena and battlepoint system!

Needs modifications on several files and in database!
SEE INSTALLATION INSTRUCTIONS AT:
http://www.anpera.net/forum/viewtopic.php?t=369

Modified with an idea by LordRaven:
Superuser is able to end fights.

ToDo:
- systemmail on interrupted battles
- bet system (place bets on winner as long as both players have
at least half of their maxhitpoints
*****************************************************/

require_once "common.php";
page_header("Das Stadion");

function 
stats($row){  // Shows player stats
    
global $session;
    
//Falls $str_output irgendwie global ist xD
    
if (!isset($str_output)) $str_output '';
    if (
$row['bufflist1']) $row['bufflist1']=adv_unserialize($row['bufflist1']);
    if (
$row['bufflist2']) $row['bufflist2']=adv_unserialize($row['bufflist2']);
    if (
$row['acctid1']==$session['user']['acctid'])
    {
        
$atk=$row['att1'];
        
$def=$row['def1'];
        
//while (list($key,$val)=each($row[bufflist1])){
        
foreach ($row['bufflist1'] AS $key => $val)
        {
            
//output(" $val[name]/$val[badguyatkmod]/$val[atkmod]/$val[badguydefmod]/$val[defmod]`n");
            
$buffs .= "`#".$val['name']." `7(".$val['rounds']." Runden übrig)`n";
            if (isset(
$val['atkmod'])) $atk *= $val['atkmod'];
            if (isset(
$val['defmod'])) $def *= $val['defmod'];
        }
        if (
$row['bufflist2'])
        {
            
//while (list($key,$val)=each($row[bufflist2])){
            
foreach ($row['bufflist2'] AS $key => $val)
            {
                
//output(" $val[name]/$val[badguyatkmod]/$val[atkmod]/$val[badguydefmod]/$val[defmod]`n");
                
if (isset($val['badguyatkmod'])) $atk *= $val['badguyatkmod'];
                if (isset(
$val['badguydefmod'])) $def *= $val['badguydefmod'];
            }
        }
        
$atk round($atk2);
        
$def round($def2);
        
$atk = ($atk == $row['att1'] ? "`^" : ($atk $row['att1'] ? "`@" "`$")) . "`b".$atk."`b`0";
        
$def = ($def == $row['def1'] ? "`^" : ($def $row['def1'] ? "`@" "`$")) . "`b".$def."`b`0";
        if (
count($row['bufflist1'])==0){
            
$buffs '`^Keine`0';
        }
    
$str_output .= '
        `0<table align="center" border="0" cellpadding="2" cellspacing="2" class="vitalinfo0">
            <tr>
                <td class="charhead" colspan="4">
                    `^`bVital-Info`b für diesen Kampf`0
                </td>
            </tr><tr>
                <td class="charinfo">`&Level:`0</td>
                <td class="charinfo">`^`b'
.$row['lvl1'].'`b`0</td>
            </tr><tr>
                <td class="charinfo">`&Lebensp.:`0</td>
                <td class="charinfo">`^'
.$row['hp1'].'/`0'.$row['maxhp1'].'</td>
            </tr><tr>
                <td class="charinfo">`&Angriff:`0</td>
                <td class="charinfo">'
.$atk.'</td>
            </tr><tr>
                <td class="charinfo">`&Verteidigung:`0</td>
                <td class="charinfo">'
.$def.'</td>
            </tr><tr>
                <td class="charinfo">`&Waffe:`0</td>
                <td class="charinfo">`^'
.$row['weapon1'].'`0</td>
            </tr><tr>
                <td class="charinfo">`&Rüstung:`0</td>
                <td class="charinfo">`^'
.$row['armor1'].'`0</td>
            </tr><tr>
                <td class="charinfo" colspan="2">`&Aktionen:`n'
.$buffs.'`0</td>
        '
;
    }
    if (
$row['acctid2']==$session['user']['acctid'])
    {
        
$atk=$row['att2'];
        
$def=$row['def2'];
        
        foreach (
$row['bufflist2'] AS $key => $val)
        {
            
$buffs .= '`#'.$val['name'].' `7('.$val['rounds'].' Runden übrig)`n';
            if (isset(
$val['atkmod'])) $atk *= $val['atkmod'];
            if (isset(
$val['defmod'])) $def *= $val['defmod'];
        }
        if (
$row['bufflist1']){
            
            foreach (
$row['bufflist1'] AS $key => $val)
            {
                if (isset(
$val['badguyatkmod'])) $atk *= $val['badguyatkmod'];
                if (isset(
$val['badguydefmod'])) $def *= $val['badguydefmod'];
            }
        }
        
$atk round($atk2);
        
$def round($def2);
        
$atk = ($atk == $row['att2'] ? "`^" : ($atk $row['att2'] ? "`@" "`$")) . "`b".$atk."`b`0";
        
$def = ($def == $row['def2'] ? "`^" : ($def $row['def2'] ? "`@" "`$")) . "`b".$def."`b`0";
        if (
count($row['bufflist2'])==0){
            
$buffs '`^Keine`0';
        }
    
$str_output .= '
        `0<table align="center" border="0" cellpadding="2" cellspacing="2" class="vitalinfo0">
            <tr>
                <td class="charhead" colspan="4">
                    `^`bVital-Info`b für diesen Kampf`0
                </td>
            </tr><tr>
                <td class="charinfo">`&Level:`0</td>
                <td class="charinfo">`^`b'
.$row['lvl2'].'`b`0</td>
            </tr><tr>
            <td class="charinfo">`&Lebenspunkte:`0</td>
            <td class="charinfo">`^'
.$row['hp2'].'/`0'.$row['maxhp2'].'
            </td>
            </tr><tr>
            <td class="charinfo">`&Angriff:`0</td>
                <td class="charinfo">'
.$atk.'</td>
            </tr><tr>
            <td class="charinfo">`&Verteidigung:`0</td>
                <td class="charinfo">'
.$def.'</td>
            </tr><tr>
                <td class="charinfo">`&Waffe:`0</td>
                <td class="charinfo">`^'
.$row['weapon2'].'`0</td>
            </tr><tr>
                <td class="charinfo">`&Rüstung:`0</td>
                <td class="charinfo">`^'
.$row['armor2'].'`0
            </td>
        </tr>
        <tr>
            <td class="charinfo" colspan="2">
                `&Aktionen:`n'
.$buffs.'`0
            </td>
        '
;
    }
    
$str_output .= '</tr></table>`n';
    
    
output($str_output);
    
}

function 
arenanav($row){ // Navigation during fight

    
global $session;

    if (
$row['turn']==1){
        
$badguy = array(
            
"acctid"    => $row['acctid2'],
            
"name"        => $row['name2'],
            
"level"        => $row['lvl2'],
            
"hitpoints"    => $row['hp2'],
            
"attack"    => $row['att2'],
            
"defense"    => $row['def2'],
            
"weapon"    => $row['weapon2'],
            
"armor"        => $row['armor2'],
            
"bufflist"    => $row['bufflist2']
        );
        
$goodguy = array(
            
"name"            => $row['name1'],
            
"level"            => $row['lvl1'],
            
"hitpoints"        => $row['hp1'],
            
"maxhitpoints"    => $row['maxhp1'],
            
"attack"        => $row['att1'],
            
"defense"        => $row['def1'],
            
"weapon"        => $row['weapon1'],
            
"armor"            => $row['armor1'],
            
"specialtyuses"    => $row['specialtyuses1'],
            
"bufflist"        => $row['bufflist1']
        );
    }
    if (
$row['turn']==2){
        
$badguy = array(
            
"acctid"    => $row['acctid1'],
            
"name"        => $row['name1'],
            
"level"        => $row['lvl1'],
            
"hitpoints"    => $row['hp1'],
            
"attack"    => $row['att1'],
            
"defense"    => $row['def1'],
            
"weapon"    => $row['weapon1'],
            
"armor"        => $row['armor1'],
            
"bufflist"    => $row['bufflist1']
        );
        
$goodguy = array(
            
"name"            => $row['name2'],
            
"level"            => $row['lvl2'],
            
"hitpoints"        => $row['hp2'],
            
"maxhitpoints"    => $row['maxhp2'],
            
"attack"        => $row['att2'],
            
"defense"        => $row['def2'],
            
"weapon"        => $row['weapon2'],
            
"armor"            => $row['armor2'],
            
"specialtyuses"    => $row['specialtyuses2'],
            
"bufflist"        => $row['bufflist2']
        );
    }

    
$GLOBALS['goodguy']=$goodguy;
    
$GLOBALS['badguy']=$badguy;

    if (
$goodguy['hitpoints']>&& $badguy['hitpoints']>0) {
        
$str_output '';
        
$str_output .= '`c`b`$~ ~ ~ Kampf ~ ~ ~`0`b`c`n';
        
$str_output .= '`@Du hast den Gegner `^'.$badguy['name'].'`@ entdeckt, der sich mit seiner Waffe `%'.$badguy['weapon'].'`@';
        
// Let's display what buffs the opponent is using - oh yeah
        
$buffs '';
        
$disp['bufflist'] = adv_unserialize($badguy['bufflist']);

        foreach (
$disp['bufflist'] AS $key => $val)
        {
            
$buffs .= ' `@und `#'.$val['name'].' `7('.$val['rounds'].' Runden)';
        }
        
$str_output .= $buffs.' `@auf dich stürzt!`0`n
            `n
            `2Level: `6'
.$badguy['level'].'`0`n
            `2`bErgebnis der letzten Runde:`b`n
            `2'
.$badguy['name']."`2's Lebenspunkte: `6".$badguy['hitpoints'].'`0`n
            `2DEINE Lebenspunkte: `6'
.$goodguy['hitpoints'].'`0`n
            `n
            <hr />`n
            '
.$row['lastmsg'];
        
output($str_output);
    }
    
addnav('Kampf');
    
addnav('Kämpfen','pvparena.php?op=fight&act=fight');
    
addnav('`bBesondere Fähigkeiten`b');
    
$sql_mod "
        SELECT 
            * 
        FROM 
            `specialty` 
        WHERE 
            `active`    = '1'
    "
;
    
$result db_query($sql_mod);
    while(
$row_mod db_fetch_assoc($result))
    {
    require_once 
"./module/specialty_modules/".$row_mod['filename'].".php";
    
// $f1 = $row['filename']."_info";
    // $f1();

    
$f2 $row_mod['filename']."_run";
    
$f2("fightnav",0,"pvparena.php?op=fight","goodguy");
    }

    if (
$row['turn']==1$owner=$row['acctid1'];
    if (
$row['turn']==2$owner=$row['acctid2'];

    
// spells by anpera, modded by talion
    
if($row['nospecials']==0)
    {
        
$result item_list_get("
            `owner`        = '"
.$session['user']['acctid']."' AND 
            `value1`    > '0' AND
            (`battle_mode` = '2' OR `battle_mode` = '3') "

        GROUP BY 
            `name` 
        ORDER BY 
            `value1` ASC, 
            `name` ASC, 
            `id` ASC 
        LIMIT 
            9
            "
true ' SUM(`value1`) AS `anzahl`, `name`, `id` ' );

        
$int_count db_num_rows($result);

        if (
$int_count>0addnav('Zauber');

        for (
$i=1;$i<=$int_count;$i++)
        {
            
$row db_fetch_assoc($result);

            
addnav($i.'?'.$row['name'].' `0('.$row['anzahl'].'x)','pvparena.php?op=fight&skill=zauber&itemid='.$row['id']);
        }
    }
    
// end spells


}
function 
activate_buffs($tag) { // activate buffs (from battle.php with modifications for multiplayer battle)
    
global $goodguy,$badguy,$message;
    
    
$result = array();
    
$result['invulnerable'] = 0// not in use
    
$result['dmgmod'] = 1;
    
$result['badguydmgmod'] = 1// not in use
    
$result['atkmod'] = 1;
    
$result['badguyatkmod'] = 1// not in use
    
$result['defmod'] = 1;
    
$result['badguydefmod'] = 1;
    
$result['lifetap'] = array();
    
$result['dmgshield'] = array();
    
    foreach (
$goodguy['bufflist'] AS $key => $buff)
    {
        if (isset(
$buff['startmsg'])) {
            
$msg $buff['startmsg'];
            
$msg str_replace("{badguy}"$badguy['name'], $msg);
            
output("`%$msg`0");
            
$message=$message.$goodguy['name'].': "`0`i'.$msg.'`0`i"`n';
            unset(
$goodguy['bufflist'][$key]['startmsg']);
        }
        
$activate strpos($buff['activate'], $tag);
        if (
$activate !== false$activate true// handle strpos == 0;
        // If this should activate now and it hasn't already activated,
        // do the round message and mark it.
        
if ($activate && !$buff['used']) {
            
// mark it used.
            
$goodguy['bufflist'][$key]['used'] = 1;
            
// if it has a 'round message', run it.
            
if (isset($buff['roundmsg'])) {
                
$msg $buff['roundmsg'];
                
$msg str_replace("{badguy}"$badguy['name'], $msg);
                if (
$msg ""){
                    
output("`)$msg`0`n");
                    
$message=$message.$goodguy['name'].': "`0`i'.$msg.'`0`i"`n';
                }
            }
        }
        
// Now, calculate any effects and run them if needed.
        
if (isset($buff['invulnerable']))
        {
            
$result['invulnerable'] = 1;
        }
        if (isset(
$buff['atkmod']))
        {
            
$result['atkmod'] *= $buff['atkmod'];
        }
        if (isset(
$buff['badguyatkmod']))
        {
            
$result['badguyatkmod'] *= $buff['badguyatkmod'];
        }
        if (isset(
$buff['defmod']))
        {
            
$result['defmod'] *= $buff['defmod'];
        }
        if (isset(
$buff['badguydefmod']))
        {
            
$result['badguydefmod'] *= $buff['badguydefmod'];
        }
        if (isset(
$buff['dmgmod']))
        {
            
$result['dmgmod'] *= $buff['dmgmod'];
        }
        if (isset(
$buff['badguydmgmod']))
        {
            
$result['badguydmgmod'] *= $buff['badguydmgmod'];
        }
        if (isset(
$buff['lifetap']))
        {
            
array_push($result['lifetap'], $buff);
        }
        if (isset(
$buff['damageshield']))
        {
            
array_push($result['dmgshield'], $buff);
        }
        if (isset(
$buff['regen']) && $activate)
        {
            
$hptoregen = (int)$buff['regen'];
            
$hpdiff $goodguy['maxhitpoints'] - $goodguy['hitpoints'];
            
// Don't regen if we are above max hp
            
if ($hpdiff 0$hpdiff 0;
            if (
$hpdiff $hptoregen$hptoregen $hpdiff;
            
$goodguy['hitpoints'] += $hptoregen;
            
// Now, take abs value just incase this was a damaging buff
            
$hptoregen abs($hptoregen);
            if (
$hptoregen == 0)
            {
                
$msg $buff['effectnodmgmsg'];
            }
            else
            {
                
$msg $buff['effectmsg'];
            }
            
$msg str_replace("{badguy}"$badguy['name'], $msg);
            
$msg str_replace("{damage}"$hptoregen$msg);
            if (
$msg ""){
                
output("`)".$msg."`0`n");
                
$message $message.$goodguy['name'].': "`0`i'.$msg.'`0`i"`n';
            }
        }
        if (isset(
$buff['minioncount']) && $activate) {
            
$who = -1;

            if (isset(
$buff['maxbadguydamage']) &&  $buff['maxbadguydamage'] != '')
            {
                if (isset(
$buff['maxbadguydamage'])  && $buff['maxbadguydamage'] != '')
                {
                    
$buff['maxbadguydamage'] = stripslashes($buff['maxbadguydamage']);
                    eval(
"\$buff['maxbadguydamage'] = $buff[maxbadguydamage];
                    "
);
                }
                
$max $buff['maxbadguydamage'];

                if (isset(
$buff['minbadguydamage']) && $buff['minbadguydamage'] != '')
                {
                    
$buff['minbadguydamage'] = stripslashes($buff['minbadguydamage']);
                    eval(
"\$buff['minbadguydamage'] = $buff[minbadguydamage];
                    "
);
                }
                
$min $buff['minbadguydamage'];
                
$who 0;
            }
            else
            {
                
$max $buff['maxgoodguydamage'];
                
$min $buff['mingoodguydamage'];
                
$who 1;
            }
            for (
$i 0$who >= && $i $buff['minioncount']; $i++) {
                
$damage e_rand($min$max);

                if (
$who == 0)
                {
                    
$badguy['hitpoints'] -= $damage;
                }
                else if (
$who == 1
                {
                    
$goodguy['hitpoints'] -= $damage;
                }

                if (
$damage 0)
                {
                    
$msg $buff['effectfailmsg'];
                }
                else if (
$damage == 0)
                {
                    
$msg $buff['effectnodmgmsg'];
                }
                else if (
$damage 0)
                {
                    
$msg $buff['effectmsg'];
                }
                if (
$msg>"") {
                    
$msg str_replace("{badguy}"$badguy['name'], $msg);
                    
$msg str_replace("{goodguy}"$session['user']['name'], $msg);
                    
$msg str_replace("{damage}"$damage$msg);
                    
output('`)'.$msg.'`0`n');
                    
$message=$message.$goodguy['name'].': "`0`i'.$msg.'`0`i"`n';
                }
            }
        }
    }
    
    foreach (
$badguy['bufflist'] AS $key => $buff)
    {
        
$activate strpos($buff['activate'], $tag);
        if (
$activate !== false$activate true;
        if (
$activate && !$buff['used'])
        {
            
$badguy['bufflist'][$key]['used'] = 1;
        }
        if (isset(
$buff['atkmod']))
        {
            
$result['badguyatkmod'] *= $buff['atkmod'];
        }
        if (isset(
$buff['defmod']))
        {
            
$result['badguydefmod'] *= $buff['defmod'];
        }
        if (isset(
$buff['badguyatkmod']))
        {
            
$result['atkmod'] *= $buff['badguyatkmod'];
        }
        if (isset(
$buff['badguydefmod']))
        {
            
$result['defmod'] *= $buff['badguydefmod'];
        }
        if (isset(
$buff['badguydmgmod']))
        {
            
$result['dmgmod'] *= $buff['badguydmgmod'];
        }
    }
    return 
$result;
}
function 
process_lifetaps($ltaps$damage) {
    global 
$goodguy,$badguy,$goodguy,$message;

    
$str_output '';

    foreach(
$ltaps AS $key => $buff)
    {
        
$healhp $goodguy['maxhitpoints'] - $goodguy['hitpoints'];
        if (
$healhp 0$healhp 0;
        if (
$healhp == 0)
        {
            
$msg $buff['effectnodmgmsg'];
        }
        else
        {
            if (
$healhp $damage $buff['lifetap']) $healhp $damage $buff['lifetap'];
            if (
$healhp 0$healhp 0;
            if (
$damage 0)
            {
                
$msg $buff['effectmsg'];
            }
            else if (
$damage == 0)
            {
                
$msg $buff['effectfailmsg'];
            }
            else if (
$damage 0)
            {
                
$msg $buff['effectfailmsg'];
            }
        }
        
$goodguy['hitpoints'] += $healhp;
        
$msg str_replace("{badguy}",$badguy['name'], $msg);
        
$msg str_replace("{damage}",$healhp$msg);
        if (
$msg ''){
            
$str_output .= '`)'.$msg.'`n';
            
$message $message.$goodguy['name'].': "`0`i'.$msg.'`0`i"`n';
        }
    }
    
output($str_output);
}

function 
process_dmgshield($dshield$damage) {
    global 
$session,$badguy,$goodguy,$message;

    
$str_output '';

    foreach (
$dshield AS $key => $buff)
    {
        
$realdamage $damage $buff['damageshield'];
        if (
$realdamage 0$realdamage 0;
        if (
$realdamage 0) {
            
$msg $buff['effectmsg'];
        } else if (
$realdamage == 0) {
            
$msg $buff['effectnodmgmsg'];
        } else if (
$realdamage 0) {
            
$msg $buff['effectfailmsg'];
        }
        
$badguy['hitpoints'] -= $realdamage;
        
$msg str_replace("{badguy}",$badguy['name'], $msg);
        
$msg str_replace("{damage}",$realdamage$msg);
        if (
$msg ""){
            
$str_output .= '`)'.$msg.'`n';
            
$message $message.$goodguy['name'].': "`0`i'.$msg.'`0`i"`n';
        }
    }
}
function 
expire_buffs() {
    global 
$badguy;
    
$str_output '';
    
$goodguy $GLOBALS['goodguy'];

    foreach (
$goodguy['bufflist'] AS $key => $buff)
    {
        if (
$buff['used']) {
            
$GLOBALS['goodguy']['bufflist'][$key]['used'] = 0;
            
$GLOBALS['goodguy']['bufflist'][$key]['rounds']--;

            if (
$GLOBALS['goodguy']['bufflist'][$key]['rounds'] <= 0) {
                if (
$buff['wearoff']) {
                    
$msg $buff['wearoff'];
                    
$msg str_replace("{badguy}"$badguy['name'], $msg);
                    if (
$msg ""){
                        
$str_output .= '`)'.$msg.'`n';
                        
$message $message.$goodguy['name'].': "`0`i'.$msg.'`0`i"`n';
                    }
                }
                unset(
$GLOBALS['goodguy']['bufflist'][$key]);
            }
        }
    }
    
output($str_output);
}

addcommentary();
$cost=$session['user']['level']*20;

if (
$_GET['op']=='challenge'//jemanden suchen / herausfordern
{
    if(
$_GET['acctid']=='' && $session['user']['playerfights']>&& ($session['user']['level']>|| $session['user']['dragonkills']>0))
    {
        
$search='';
        if ((isset(
$_POST['search']) && $_POST['search']!='') || $_GET['search']>"")
        {
            if (
$_GET['search']>''$_POST['search']=$_GET['search'];
            
$search str_create_search_string($_POST['search']);
            
$search ="a.name LIKE '".$search."' AND ";
            
$linkoptions='&search='.$_POST['search'];
        }
        if(isset(
$_POST['dkmin']) || $_GET['dkmin']>0)
        {
            
$dkmin=intval($_POST['dkmin']) + intval($_GET['dkmin']);
            if(
$dkmin>0)
            {
                
$search.="a.dragonkills >= ".$dkmin." AND ";
                
$linkoptions.='&dkmin='.$dkmin;
            }
        }
        if(isset(
$_POST['dkmax']) || $_GET['dkmax']>0)
        {
            
$dkmax=intval($_POST['dkmax']) + intval($_GET['dkmax']);
            if(
$dkmax>0)
            {
                
$search.="a.dragonkills <= ".$dkmax." AND ";
                
$linkoptions.='&dkmax='.$dkmax;
            }
        }
        if(
$_POST['online']=='1' || $_GET['online']=='1')
        {
            
$timeout getsetting('LOGINTIMEOUT',900);
            
$timeout_date date'Y-m-d H:i:s' time() - $timeout );
            
$search.="a.loggedin=1 AND laston>'".$timeout_date."' AND";
            
$linkoptions.='&online=1';
        }

        
$ppp=25// Players Per Page to display
        
if (!$_GET['limit'])
        {
            
$page=0;
        }
        else
        {
            
$page=(int)$_GET['limit'];
            
addnav('Vorherige Seite','pvparena.php?op=challenge&limit='.($page-1).$linkoptions);
        }
        
$limit="".($page*$ppp).','.($ppp+1); // love PHP for this ;)
        
pvpwarning();
        
$days getsetting('pvpimmunity'5);
        
$exp getsetting('pvpminexp'1500);
        require_once(
LIB_PATH.'jslib.lib.php');
        
        
output('`6Wen willst du zu einem Duell mit allen Fähigkeiten herausfordern? Die Stadiongebühr kostet dich `^'.$cost.' `6Gold. Dein Gegner wird nicht unvorbereitet zustimmen.`n
        Herausforderungen aussprechen kannst du außerdem nur gegen Gegner, die mindestens Level 5 erlangt oder aber bereits eine Heldentat vollbracht haben.`n
        `nDu kannst heute noch `4'
.$session['user']['playerfights'].'`6 mal gegen einen anderen Kämpfer antreten.`n`n
        `0<form action="pvparena.php?op=challenge" method="POST">`wSuchen nach:`0
        `nName: <input name="search" value="'
.$_POST['search'].'">
        `nHT von: <input name="dkmin" value="'
.$_POST['dkmin'].'" size="3">
        bis: <input name="dkmax" value="'
.$_POST['dkmax'].'" size="3">
        `nonline: <select name="online">
        <option value="1">Ja</option>
        <option value="0"'
.($_POST['online']==='0'?' selected':'').'>Egal</option>
        </select>
        `n<input type="submit" class="button" value="Suchen">
        </form>
        `n'
,true);
        
addnav('','pvparena.php?op=challenge');
        
        
$bool_lockhtml $access_control->su_check(access_control::SU_RIGHT_LOCKHTML);
        
$sql "
            SELECT     
                a.login,
                a.acctid,
                a.imprisoned,
                a.activated,
                a.expedition,
                a.sex,
                a.name,
                a.profession,
                a.alive,
                a.location,
                a.level,
                a.laston,
                a.loggedin,
                a.pvpflag,
                a.dragonkills,
                a.experience,
                a.locked
                "
.($bool_lockhtml ", aei.html_locked" "")."
            FROM 
                accounts a
                "
.($bool_lockhtml "INNER JOIN account_extra_info aei ON a.acctid = aei.acctid" "").
            WHERE 
                "
.$search."
                (a.locked    = '0')    AND"
.
//                (age             > '".$days."' OR a.dragonkills > '0' OR pk > '0' OR a.experience > '".$exp."') AND
//                age             <= '".getsetting('maxagepvp',50)."'     AND
//                a.level        >= '".($session['user']['level']-1)."'     AND 
//                a.level        <= '".($session['user']['level']+2)."'     AND
                
"(a.level > 4 OR a.dragonkills > 0) AND 
                a.acctid    != '"
.$session['user']['acctid']."'
            ORDER BY 
                a.login='"
.db_real_escape_string($_POST['search'])."' DESC,
                a.dragonkills     DESC,
                a.level         DESC
            LIMIT 
                "
.$limit;
        
$result db_query($sql);
        if (
db_num_rows($result)>$ppp
        {
            
addnav('Nächste Seite','pvparena.php?op=challenge&limit='.($page+1).$linkoptions);
        }
        
$str_out '
            <table border="0" cellpadding="2" cellspacing="1" bgcolor="#999999">
                <tr class="trhead">
                    <th>Name</th>
                    <th>HT</th>
                    <th>Level</th>
                    <th>Status</th>
                </tr>'
;
        
$max db_num_rows($result);
        for (
$i=0;$i<$max;$i++)
        {
            
$row db_fetch_assoc($result);
            
$loggedin=user_get_online(0,$row);
            
$str_out .= '
                <tr class="'
.($i%2?'trlight':'trdark').'">
                    <td>'
.jslib_getmenuuserlink$row$rowtrue ).'`0</td>
                    <td align="right">'
.$row['dragonkills'].'</td>
                    <td align="center">'
.$row['level'].'</td>
                    <td>'
.($loggedin?'`#Online`0':'`3Offline`0').'</td>
                </tr>'
;
            
addnav('','pvparena.php?op=challenge&acctid='.$row['acctid']);
            
addnav('','pvparena.php?op=challenge&nospec=1&acctid='.$row['acctid']);
        }
        
$str_out .= '</table>';
        
$js_add '
            function JSLIB_PVPARENA(noSpecials){
                //alert("noSpecials="+noSpecials);
                window.location.href = "pvparena.php?op=challenge&acctid=" + g_user_menu.m_pl.m_id;
            }'
;
        
$js_add .= '
            function JSLIB_PVPARENA1(){
                window.location.href = "pvparena.php?op=challenge&nospec=1&acctid=" + g_user_menu.m_pl.m_id;
            }'
;
        
$js_afterinit 'g_user_menu.insertItem(1, new LOTGD.MenuItem( {label: "Herausfordern", icon: "images/schwert.gif", action: JSLIB_PVPARENA} ) );';
        
$js_afterinit .= 'g_user_menu.insertItem(2, new LOTGD.MenuItem( {label: "Kampf ohne Specials", icon: "images/schwert.gif", action: JSLIB_PVPARENA1} ) );';
        
$str_out .= jslib_initmenu$js_add$js_afterinit );

        
/*if($access_control->su_check(access_control::SU_RIGHT_DEBUG))
        {
            $str_out.='`nQuerystring:'.$sql.'`n';
        }*/

        
output($str_out);
        
addnav('Zurück zum Stadion','pvparena.php');
    }
    else if (
$session['user']['playerfights']<=0)
    {
        
output('`6Du kannst heute keinen weiteren Kämpfer mehr herausfordern.');
        
addnav('Zurück zum Stadion','pvparena.php');
    }
    else if (
$session['user']['level']<=&& $session['user']['dragonkills']==0)
    {
        
output('`6Der Stadionwärter lacht sich darüber kaputt, dass ein so kleiner Schwächling wie du im Stadion kämpfen will. Vielleicht solltest du wirklich erst etwas mehr Kampferfahrung sammeln.');
        
addnav('Zurück zum Stadion','pvparena.php');
    }
    else
    {
        if (
$session['user']['gold']>=$cost)
        {
            
$sql "
                SELECT 
                    `acctid`,
                    `name`,
                    `level`,
                    `sex`,
                    `hitpoints`,
                    `maxhitpoints`,
                    `lastip`,
                    `emailaddress`,
                    `uniqueid` 
                FROM 
                    `accounts` 
                WHERE 
                    `acctid`    = '"
.$_GET['acctid']."'
            "
;
            
$result db_query($sql);
            
$row db_fetch_assoc($result);

            if (
ac_check($row))
            {
                
output('`n`4Du kannst deine eigenen oder derart verwandte Spieler nicht zu einem Duell herausfordern!`0`n`n');
            }
            else
            {
                
$sql "
                    SELECT 
                        * 
                    FROM 
                        `pvp` 
                    WHERE 
                        `acctid2`    = '"
.$session['user']['acctid']."'     OR 
                        `acctid1`    = '"
.$row['acctid']."'                 OR 
                        `acctid2`    = '"
.$row['acctid']."'
                "
;
                
$result db_query($sql);
                if (
db_num_rows($result))
                {
                    
output('`6Bei dieser Herausforderung ist dir jemand zuvor gekommen!');
                }
                else
                {
                    
$nospec = (bool)$_GET['nospec'];
                    if (
$nospec)
                    {
                        
$specs serialize(array());
                        
$buffs $specs;
                    }
                    else
                    {
                        
$specs db_real_escape_string(serialize($session['user']['specialtyuses']));
                        
$buffs db_real_escape_string(is_array($session['user']['bufflist'])?serialize($session['user']['bufflist']):$session['user']['bufflist']);
                    }
                    
$nospec = (int)$nospec;
                    
                    
$sql "
                        INSERT INTO 
                            `pvp` 
                        SET
                            `acctid1`        = '"
.$session['user']['acctid']."',
                            `acctid2`        = '"
.$row['acctid']."',
                            `name1`            = '"
.addslashes($session['user']['name'])."',
                            `name2`            = '"
.addslashes($row['name'])."',
                            `lvl1`            = '"
.$session['user']['level']."',
                            `lvl2`            = '"
.$row['level']."',
                            `hp1`            = '"
.$session['user']['hitpoints']."',
                            `maxhp1`        = '"
.$session['user']['maxhitpoints']."',
                            `att1`            = '"
.$session['user']['attack']."',
                            `def1`            = '"
.$session['user']['defence']."',
                            `weapon1`        = '"
.addslashes($session['user']['weapon'])."',
                            `armor1`        = '"
.addslashes($session['user']['armor'])."',
                            `specialtyuses1`    = '"
.$specs."',
                            `bufflist1`        = '"
.$buffs."',
                            `turn`            = '0',
                            `nospecials`    = '"
.$nospec."'
                    "
;
                    
db_query($sql);
                    if (
db_affected_rows(LINK)<=0redirect('pvparena.php');
                    
output('
                        `6Du hast`4 '
.$row['name'].' `6zu einem Duell herausgefordert und 
                        wartest nun auf '
.($row['sex']?'ihre':'seine').' Antwort. 
                        Du könntest '
.$row['name'].'`6 den Kampf schmackhafter machen, 
                        indem du '
.($row['sex']?'ihr':'ihm').' die Stadiongebühr 
                        von  `^'
.($row['level']*20).'`6 Gold überweist.`n
                    '
);
                    if (
$session['user']['dragonkills']<2
                        
output('
                            `n
                            `n
                            `i(Du kannst jetzt ganz normal weiterspielen. 
                                Wenn '
.$row['name'].'`6 sich meldet, bekommst du eine Nachricht.)`i
                        '
);
                    
systemmail($row['acctid'],'`2Du wurdest herausgefordert!','
                        `2'
.$session['user']['name'].'`2 (Level '.$session['user']['level'].') 
                        hat dich zu einem Duell im Stadion 
                        '
.($nospec?'`&`bohne Spezialfähigkeiten`b`2 ':'').'herausgefordert. 
                        Du kannst diese Herausforderung im Stadion annehmen oder ablehnen, 
                        solange sich dein Level nicht ändert.`n
                        Bereite dich gut vor und betritt das Stadion erst dann!
                    '
);
                    
$session['user']['gold']-=$cost;
                    
$session['user']['reputation']++;
                }
            }
            
addnav('Zurück zum Stadion','pvparena.php');
        }
        else
        {
            
output('`4Du hast nicht genug Gold dabei, um die Stadiongebühr zu bezahlen. Mit rotem Kopf ziehst du ab.');
            
addnav('Zum Stadion','pvparena.php');
        }
    }
    
addnav('Zum Bahnhofsplatz','village.php');
}

else if (
$_GET['op']=='deny'//Herausforderung ablehnen
{
    
$sql "
        DELETE FROM 
            `pvp` 
        WHERE 
            `acctid2`    = '"
.$session['user']['acctid']."'
    "
;
    
db_query($sql);
    
$sql "
        SELECT 
            `acctid`,
            `name` 
        FROM 
            `accounts` 
        WHERE 
            `acctid`    = '"
.$_GET['id']."'
    "
;
    
$result db_query($sql);
    
$row db_fetch_assoc($result);
    
output('
        `6Beim Anblick deines Gegners '
.$row['name'].' `6wird dir Angst und Bange. 
        Mit ein paar sehr dürftigen Ausreden wie "nicht genug Gold" lehnst du die Herausforderung ab und 
        verlässt schnell das Stadion.
    '
);
    
systemmail($row['acctid'],'`2Herausforderung abgelehnt','
        `2'
.$session['user']['name'].'`2 hat deine Herausforderung abgelehnt. 
        Vielleicht solltest du '
.($session['user']['sex']?'ihr':'ihm').' etwas für den Kampf anbieten - 
        falls '
.($session['user']['sex']?'sie':'er').' dich besiegen kann.
    '
);
    
addnav('Zum Bahnhofsplatz','village.php');
}

else if (
$_GET['op']=='accept'//Herausforderung annehmen
{
    if(
$session['user']['gold']<$cost)
    {
        
output('`4Du kannst dir die Stadion-Nutzungsgebühr von `^'.$cost.'`4 Gold nicht leisten.');
        
addnav('Zum Bahnhofsplatz','village.php');
    }
    else if(
$session['user']['playerfights']<=0)
    {
        
output('`4Du kannst heute nicht mehr gegen andere Kämpfer antreten.');
        
addnav('Zum Bahnhofsplatz','village.php');
    }
    else
    {
        if (
$_GET['nospec'])
        {
            
$specs serialize(array());
            
$buffs $specs;
        }
        else
        {
            
$specs db_real_escape_string(serialize($session['user']['specialtyuses']));
            
$buffs db_real_escape_string(is_array($session['user']['bufflist'])?serialize($session['user']['bufflist']):$session['user']['bufflist']);
        }
        
$sql "
            UPDATE 
                `pvp` 
            SET 
                `name2`                = '"
.addslashes($session['user']['name'])."',
                `hp2`                = '"
.$session['user']['hitpoints']."',
                `maxhp2`            = '"
.$session['user']['maxhitpoints']."',
                `att2`                = '"
.$session['user']['attack']."',
                `def2`                = '"
.$session['user']['defence']."',
                `weapon2`            = '"
.addslashes($session['user']['weapon'])."',
                `armor2`            = '"
.addslashes($session['user']['armor'])."',
                `specialtyuses2`    = '"
.$specs."',
                `bufflist2`            = '"
.$buffs."',
                `turn`                = '2' 
            WHERE 
                `acctid2`    = '"
.$session['user']['acctid']."'
        "
;
        
db_query($sql);
        if (
db_affected_rows(LINK)<=0redirect('pvparena.php');
        
$sql "
            SELECT 
                * 
            FROM 
                `pvp` 
            WHERE 
                `acctid1`    = '"
.$session['user']['acctid']."' OR 
                `acctid2`    = '"
.$session['user']['acctid']."'
        "
;
        
$result db_query($sql);
        
$row db_fetch_assoc($result);
        
$row['specialtyuses1'] = adv_unserialize($row['specialtyuses1']);
        
$row['specialtyuses2'] = adv_unserialize($row['specialtyuses2']);

        
$session['user']['gold'] -= $cost;
        
$session['user']['reputation']++;
        
arenanav($row);
        
stats($row);
    }
}

else if (
$_GET['op']=='back'//Herausforderung zurückziehen
{
    
$sql "
        SELECT 
            `acctid`,
            `name` 
        FROM 
            `accounts` 
        WHERE 
            `acctid`    = '"
.$_GET['id']."'
    "
;
    
$result db_query($sql);
    
$row db_fetch_assoc($result);
    
output('
        `6Du bist es Leid, auf '
.$row['name'].'`6 zu warten und ziehst deine Herausforderung zurück. 
        Die Stadiongebühr bekommst aber trotz langer Verhandlungen mit der Stadion-Leitung nicht zurück.`n
    '
);
    
$sql "
        DELETE FROM 
            `pvp` 
        WHERE 
            `acctid1`    = '"
.$session['user']['acctid']."'
    "
;
    
db_query($sql);
    
$session['user']['reputation']--;
    
systemmail($row['acctid'],'`2Herausforderung zurückgezogen','
        `2'
.$session['user']['name'].'`2 hat '.($session['user']['sex']?'ihre':'seine').' Herausforderung zurückgezogen.
    '
);
    
addnav('Zum Bahnhofsplatz','village.php');
}

else if (
$_GET['op']=='fight')
{
    
$sql "
        SELECT 
            * 
        FROM 
            `pvp` 
        WHERE 
            `acctid1`    = '"
.$session['user']['acctid']."' OR 
            `acctid2`    = '"
.$session['user']['acctid']."'
    "
;
    
$result db_query($sql);
    
$row db_fetch_assoc($result);
    if (
$row['turn']==1)
    {
        
$badguy = array(
            
'acctid'    => $row['acctid2'],
            
'name'        => $row['name2'],
            
'level'        => $row['lvl2'],
            
'hitpoints'    => $row['hp2'],
            
'attack'    => $row['att2'],
            
'defense'    => $row['def2'],
            
'weapon'    => $row['weapon2'],
            
'armor'        => $row['armor2'],
            
'bufflist'    => $row['bufflist2']
        );
        
$goodguy = array(
            
'name'            => $row['name1'],
            
'level'            => $row['lvl1'],
            
'hitpoints'        => $row['hp1'],
            
'maxhitpoints'    => $row['maxhp1'],
            
'attack'        => $row['att1'],
            
'defense'        => $row['def1'],
            
'weapon'        => $row['weapon1'],
            
'armor'            => $row['armor1'],
            
'specialtyuses'    => $row['specialtyuses1'],
            
'bufflist'        => $row['bufflist1']
        );
    }
    elseif (
$row['turn']==2)
    {
        
$badguy = array(
            
'acctid'    => $row['acctid1'],
            
'name'        => $row['name1'],
            
'level'        => $row['lvl1'],
            
'hitpoints'    => $row['hp1'],
            
'attack'    => $row['att1'],
            
'defense'    => $row['def1'],
            
'weapon'    => $row['weapon1'],
            
'armor'        => $row['armor1'],
            
'bufflist'    => $row['bufflist1']
        );
        
$goodguy = array(
            
'name'            => $row['name2'],
            
'level'            => $row['lvl2'],
            
'hitpoints'     => $row['hp2'],
            
'maxhitpoints'    => $row['maxhp2'],
            
'attack'        => $row['att2'],
            
'defense'        => $row['def2'],
            
'weapon'        => $row['weapon2'],
            
'armor'            => $row['armor2'],
            
'specialtyuses'    => $row['specialtyuses2'],
            
'bufflist'        => $row['bufflist2']
        );
    }
    
stats($row);
    
$adjustment=1;
    
$goodguy['bufflist'] = adv_unserialize($goodguy['bufflist']);
    
$badguy['bufflist'] = adv_unserialize($badguy['bufflist']);

    
// spells
    
if ($_GET['skill']=='zauber')
    {

        
$id = (int)$_GET['itemid'];
        
$zauber item_get' id= '.$id );
        
$item $zauber;

        if(!empty(
$zauber['battle_hook'])) {
            
item_load_hook($zauber['battle_hook'],'battle_arena',$zauber);
        }

        if(!
$item_hook_info['hookstop']) {
            if(
$item['buff1'] > 0) {$list .= ','.$item['buff1'];}
            if(
$item['buff2'] > 0) {$list .= ','.$item['buff2'];}

            
$buffs item_get_buffsITEM_BUFF_FIGHT $list );

            if(
sizeof($buffs) > 0
            {
                foreach(
$buffs as $b
                {
                    
$GLOBALS['goodguy']['bufflist'][$b['name']] = $b;
                }
            }

            
$item['gold']=round($item['gold']*($item['value1']/($item['value2']+1)));
            
$item['gems']=round($item['gems']*($item['value1']/($item['value2']+1)));

            
$item['value1']--;

            if (
$item['value1']<=&& $item['hvalue']<=0)
            {
                
item_delete(' id='.$item['id']);
            }
            else
            {
                
item_set(' id='.$item['id'], $item);
            }
        }

    }
    
// end spells

    
elseif(file_exists('./module/specialty_modules/specialty_'.$_GET['skill'].'.php'))
    {
        require_once(
'./module/specialty_modules/specialty_'.$_GET['skill'].'.php');
        
$f 'specialty_'.$_GET['skill'].'_info';
        
$f();
        
$f1 'specialty_'.$_GET['skill'].'_run';

        
$f1('buff',0,0,'goodguy');
    }
    if (
$goodguy['hitpoints']>&& $badguy['hitpoints']>0
    {
        
$str_output ='`c`b`$~ ~ ~ Kampf ~ ~ ~`0`b`c`n';
        
$str_output.='`@Du hast den Gegner `^'.$badguy['name'].'`@ entdeckt, der sich mit seiner Waffe `%'.$badguy['weapon'].'`@';
        
// Let's display what buffs the opponent is using - oh yeah
        
$buffs '';
        
$disp['bufflist']=$badguy['bufflist'];
        foreach (
$disp['bufflist'] AS $key => $val){
            
$str_output.=' `@und `#'.$val['name'].' `7('.$val['rounds'].' Runden)';
        }
        
$str_output.=' `@auf dich stürzt!`n`n
        `2Level: `6'
.$badguy['level'].'`n
        `2`bBeginn der Runde:`b`n
        `2'
.$badguy['name'].'`2\'s Lebenspunkte: `6'.$badguy['hitpoints'].'`n
        `2DEINE Lebenspunkte: `6'
.$goodguy['hitpoints'].'`0`n`n';
    }
    
output($str_output); //Zwischenausgabe
    
$str_output='';
    foreach (
$goodguy['bufflist'] AS $key => $buff)
    {
        
$buff['used']=0;
    }

    if (
$badguy['hitpoints']>&& $goodguy['hitpoints']>0)
    {
        
$buffset activate_buffs("roundstart");
        
$creaturedefmod=$buffset['badguydefmod'];
        
$creatureatkmod=$buffset['badguyatkmod'];
        
$atkmod=$buffset['atkmod'];
        
$defmod=$buffset['defmod'];
    }
    if (
$badguy['hitpoints']>&& $goodguy['hitpoints']>0)
    {
        
$adjustedcreaturedefense $badguy['defense'];
        
$creatureattack $badguy['attack']*$creatureatkmod;
        
$adjustedselfdefense = ($goodguy['defense'] * $adjustment $defmod);

        
// Wenn kein Schaden entsteht, irgendwann abbrechen: Sonst Endlosschleife
        
$int_iterations 0;

        while(
$creaturedmg==&& $selfdmg==&& $int_iterations 100)
        {
            
$int_iterations ++;

            
$atk $goodguy['attack']*$atkmod;
            if (
e_rand(1,20)==1$atk*=3;
            
$patkroll e_rand(0,$atk);
            
$catkroll e_rand(0,$adjustedcreaturedefense);
            
$creaturedmg 0-(int)($catkroll $patkroll);
            if (
$creaturedmg<0
            {
                
$creaturedmg = (int)($creaturedmg/2);
                
$creaturedmg round($buffset['badguydmgmod']*$creaturedmg,0);
            }
            if (
$creaturedmg 0
            {
                
$creaturedmg round($buffset['dmgmod']*$creaturedmg,0);
            }
            
$pdefroll e_rand(0,$adjustedselfdefense);
            
$catkroll e_rand(0,$creatureattack);
            
$selfdmg 0-(int)($pdefroll $catkroll);
            if (
$selfdmg<0
            {
                
$selfdmg=(int)($selfdmg/2);
                
$selfdmg round($selfdmg*$buffset['dmgmod'], 0);
            }
            if (
$selfdmg 0
            {
                
$selfdmg round($selfdmg*$buffset['badguydmgmod'], 0);
            }
        }
    }
    if (
$badguy['hitpoints']>&& $goodguy['hitpoints']>0)
    {
        
$buffset activate_buffs('offense');
        if (
$atk $goodguy['attack']) 
        {
            if (
$atk $goodguy['attack']*3)
            {
                if (
$atk $goodguy['attack']*4)
                {
                    
$str_output.='`&`bDu holst zu einem <big><big>MEGA</big></big> Powerschlag aus!!!`b`n';
                }
                else
                {
                    
$str_output.='`&`bDu holst zu einem DOPPELTEN Powerschlag aus!!!`b`n';
                }
            }
            else
            {
                if (
$atk>$goodguy['attack']*2)
                {
                    
$str_output.='`&`bDu holst zu einem Powerschlag aus!!!`b`0`n';
                }
                elseif (
$atk>$goodguy['attack']*1.25)
                {
                    
$str_output.='`7`bDu holst zu einem kleinen Powerschlag aus!`b`0`n';
                }
            }
        }
        if (
$creaturedmg==0)
        {
            
$str_output.='`4Du versuchst `^'.$badguy['name'].'`4 zu treffen, aber `$TRIFFST NICHT!`n';
            
$message=$message.'`^'.$goodguy['name'].'`4 versucht dich zu treffen, aber `$TRIFFT NICHT!`n';
            if (
$badguy['hitpoints']>&& $goodguy['hitpoints']>0)
            {
                
process_dmgshield($buffset['dmgshield'], 0);
            }
            if (
$badguy['hitpoints']>&& $goodguy['hitpoints']>0
            {
                
process_lifetaps($buffset['lifetap'], 0);
            }
        }
        else if (
$creaturedmg<0)
        {
            
$str_output.='`4Du versuchst `^'.$badguy['name'].'`4 zu treffen, aber der `$ABWEHRSCHLAG `4trifft dich mit `$'.(0-$creaturedmg).'`4 Schadenspunkten!`n';
            
$message=$message.'`^'.$goodguy['name'].'`4 versucht dich zu treffen, aber dein `$ABWEHRSCHLAG`4 trifft mit `$'.(0-$creaturedmg).'`4 Schadenspunkten!`n';
            
$badguy['diddamage']=1;
            
$goodguy['hitpoints']+=$creaturedmg;
            if (
$badguy['hitpoints']>&& $goodguy['hitpoints']>0
            {
                
process_dmgshield($buffset['dmgshield'],-$creaturedmg);
            }
            if (
$badguy['hitpoints']>&& $goodguy['hitpoints']>0
            {
                
process_lifetaps($buffset['lifetap'],$creaturedmg);
            }
        }
        else
        {
            
$str_output.='`4Du triffst `^'.$badguy['name'].'`4 mit `^'.$creaturedmg.'`4 Schadenspunkten!`n';
            
$message=$message.'`^'.$goodguy['name'].'`4 trifft dich mit `^'.$creaturedmg.'`4 Schadenspunkten!`n';
            
$badguy['hitpoints']-=$creaturedmg;
            if (
$badguy['hitpoints']>&& $goodguy['hitpoints']>0
            {
                
process_dmgshield($buffset['dmgshield'],-$creaturedmg);
            }
            if (
$badguy['hitpoints']>&& $goodguy['hitpoints']>0
            {
                
process_lifetaps($buffset['lifetap'],$creaturedmg);
            }
        }
        
// from hardest punch mod -- remove if not installed!!
        
if ($creaturedmg>$session['user']['punch']){
            
$session['user']['punch']=$creaturedmg;
            
$str_output.='`@`b`c--- DAS WAR DEIN BISHER HÄRTESTER SCHLAG! ---`c`b`n';
        }
        
// end hardest punch
    
}
    if (
$goodguy['hitpoints']>&& $badguy['hitpoints']>0
    {
        
$buffset activate_buffs("defense");
    }
    
expire_buffs();
    if (
$goodguy['hitpoints']>&& $badguy['hitpoints']>0)
    {
        
$str_output.='`n`2`bEnde der Runde:`b`n';
        
$str_output.="`2".$badguy['name']."`2's Lebenspunkte: `6".$badguy['hitpoints']."`0`n";
        
$str_output.='`2DEINE Lebenspunkte: `6'.$goodguy['hitpoints'].'`0`n';
    }

    
$goodguy['bufflist'] = serialize($goodguy['bufflist']);
    
$badguy['bufflist'] = serialize($badguy['bufflist']);
    if (
$row['acctid1'])
    { 
// battle still in DB? Result of round:
        
if ($badguy['hitpoints']>&& $goodguy['hitpoints']>0)
        {
            
$message addslashes($message);
            if (
$row['turn']==1
            {
                
$sql "
                    UPDATE 
                        `pvp` 
                    SET 
                        `hp1`                = '"
.$goodguy['hitpoints']."',
                        `hp2`                = '"
.$badguy['hitpoints']."',
                        `specialtyuses1`    = '"
.$goodguy['specialtyuses']."',
                        `bufflist1`            = '"
.addslashes($goodguy['bufflist'])."',
                        `lastmsg`            = '"
.$message."',
                        `turn`                = '2' 
                    WHERE 
                        `acctid1`            = '"
.$session['user']['acctid']."'
                "
;
            }
            elseif (
$row['turn']==2
            {
                
$sql "
                    UPDATE 
                        `pvp` 
                    SET 
                        `hp1`                = '"
.$badguy['hitpoints']."',
                        `hp2`                = '"
.$goodguy['hitpoints']."',
                        `specialtyuses2`    = '"
.$goodguy['specialtyuses']."',
                        `bufflist2`            = '"
.addslashes($goodguy['bufflist'])."',
                        `lastmsg`            = '"
.$message."',
                        `turn`                = '1' 
                    WHERE 
                        `acctid2`            = '"
.$session['user']['acctid']."'
                "
;
            }
            
db_query($sql);
            if (
db_affected_rows(LINK)<=0redirect("pvparena.php");
            
$str_output.='`n`n`2Du erwartest den Zug deines Gegners.';
            
addnav('Aktualisieren','pvparena.php');
        }
        else if (
$badguy['hitpoints']<=0//Eigener Sieg
        
{
            
$win=$badguy['level']*20+$goodguy['level']*20;
            
$exp=$badguy['level']*10-(abs($goodguy['level']-$badguy['level'])*10);

            
//Wenn das eigene Leven kleiner ist...
            
if ($badguy['level']<=$goodguy['level'])
            {
                
$session['user']['battlepoints']+=2;
            }
            else
            {
                
//3* die Differenz
                
$session['user']['battlepoints']+=3*($badguy['level']-$goodguy['level']);
            }
            
$session['user']['reputation']+=5;
            
$str_output.='`n`&Kurz vor deinem finalen Todesstoß beendet der Schiedsrichter euren Kampf und erklärt dich zum Sieger!`0`n`b`$Du hast '.$badguy['name'].' `$besiegt!`0`b`n`#Du bekommst das Preisgeld in Höhe von `^'.$win.'`# Gold und deinen gerechten Lohn an Stadionkampfpunkten!`nDu bekommst insgesamt `^'.$exp.'`# Erfahrungspunkte!`n`0';
            
$session['user']['donation']+=1;
            
$session['user']['gold']+=$win;
            
$session['user']['playerfights']--;
            
$session['user']['experience']+=$exp;
            
$exp round(getsetting('pvpdeflose',5)*10,0);
            
user_update(
                array
                (
                    
'charm'=>array('sql'=>true,'value'=>'charm-1'),
                    
'experience'=>array('sql'=>true,'value'=>'experience-'.$exp),
                    
'playerfights'=>array('sql'=>true,'value'=>'playerfights-1')
                ),
                
$badguy['acctid']
            );

            
systemmail($badguy['acctid'],'`2Du wurdest im Stadion besiegt',
                
'`^'.$goodguy['name'].'`2 hat dich mit '.($session['user']['sex']?'ihrem':'seinem').
                `^'
.$goodguy['weapon'].'`2 im Stadion besiegt!`n
                `n
                '
.($session['user']['sex']?'Sie':'Er').' hatte am Ende noch `^'.$goodguy['hitpoints'].'`2 Lebenspunkte übrig.`n
                `n
                Du hast `$'
.$exp.'`2 Erfahrungspunkte verloren.
            '
);
            
addnews('`$'.$goodguy['name'].'`6 besiegt `$'.$badguy['name'].'`6 bei einem Duell im `8Stadion`6!');
            
$sql "
                DELETE FROM 
                    `pvp` 
                WHERE 
                    `acctid1`    = '"
.$session['user']['acctid']."' OR 
                    `acctid2`    = '"
.$session['user']['acctid']."'
            "
;
            
db_query($sql);
        }
        else if (
$goodguy['hitpoints']<=0)
        {
            
$exp=$badguy['level']*10-(abs($goodguy['level']-$badguy['level'])*10);
            
$win=$badguy['level']*20+$goodguy['level']*20;
            if (
$badguy['level']>=$goodguy['level'])
            {
                
$points=2;
            }
            else
            {
                
$points=3*($goodguy['level']-$badguy['level']);
            }
            
$badguy['acctid']=(int)$badguy['acctid'];
            
$badguy['creaturegold']=(int)$badguy['creaturegold'];
            
systemmail($badguy['acctid'],'`2 Du warst im Stadion erfolgreich! ','
                `^'
.$session['user']['name'].'`2 hat im Stadion verloren!`n
                `n
                Dafür hast du `^'
.$exp.'`2 Erfahrungspunkte und `^'.$win.'`2 Gold erhalten!
            '
);
            
            
user_update(
                array
                (
                    
'gold'=>array('sql'=>true,'value'=>'gold+'.$win),
                    
'experience'=>array('sql'=>true,'value'=>'experience-'.$exp),
                    
'playerfights'=>array('sql'=>true,'value'=>'playerfights-1'),
                    
'battlepoints'=>array('sql'=>true,'value'=>'battlepoints+'.$points),
                    
'reputation'=>array('sql'=>true,'value'=>'reputation+5'),
                ),
                
$badguy['acctid']
            );
            
            
$exp round(getsetting("pvpdeflose",5)*10,0);
            
$session['user']['experience'] -= $exp;
            
$session['user']['playerfights']--;
            
$str_output.'`n`b`&Du wurdest von `%'.$badguy['name'].'`& besiegt!!!`n'.get_taunt().'`n`4Du hast `^'.$exp.' Erfahrungspunkte verloren!`n';
            if (
$session['user']['charm']>0$session['user']['charm']--;
            
addnews('`$'.$badguy['name'].'`6 besiegt `$'.$goodguy['name'].'`6 bei einem Duell im `8Stadion`6!');
            
$sql "
                DELETE FROM 
                    `pvp` 
                WHERE 
                    `acctid1`    = '"
.$session['user']['acctid']."' OR 
                    `acctid2`    = '"
.$session['user']['acctid']."'
            "
;
            
db_query($sql);
        }
    }
    else
    {
        
output('`6Euer Kampf wurde vorzeitig beendet. Die Nutzungsgebühr kommt dem Ausbau des Stadions zugute.');
    }
    
output($str_output);
    
addnav('Zum Bahnhofsplatz','village.php');
}

else if (
$_GET['op']=='del')
{
    
$sql "
        DELETE FROM 
            `pvp` 
        WHERE 
            `acctid1`    = '"
.$_GET['kid1']."' AND 
            `acctid2`    = '"
.$_GET['kid2']."'
    "
;
    
db_query($sql);
    
output('Der Schiedsrichter beendet einen langweiligen Kampf.');
    
systemmail($_GET['kid1'],'`2Dein Stadionskampf wurde beendet!','`@Dein Kampf im Stadion wurde vom Schiedsrichter beendet.');
    
systemmail($_GET['kid2'],'`2Dein Stadionskampf wurde beendet!','`@Dein Kampf im Stadion wurde vom Schiedsrichter beendet.');

    
addnav('Zum Stadion','pvparena.php');
    
addnav('Zum Bahnhofsplatz','village.php');
}

else 
//if ($_GET['op']=='')
{
    
$sql "
        SELECT 
            * 
        FROM 
            `pvp` 
        WHERE 
            `acctid1`    = '"
.$session['user']['acctid']."' OR 
            `acctid2`    = '"
.$session['user']['acctid']."'
    "
;
    
$result db_query($sql);
    
$row db_fetch_assoc($result);

    
$row['specialtyuses1']=adv_unserialize($row['specialtyuses1']);
    
$row['specialtyuses2']=adv_unserialize($row['specialtyuses2']);

    
$text=0;
    if(
$row['acctid1']==$session['user']['acctid'] && $row['turn']==0)
    {
        
$text=1;
        
output('
            `6Da du noch eine Herausforderung mit `&'
.$row['name2'].' `6offen hast, 
            machst du dich auf in Richtung Stadion, um nach deinem Gegner Ausschau zu halten. 
            Doch der scheint nirgendwo in Sicht zu sein.`n
        '
);
        
addnav('Herausforderung zurücknehmen','pvparena.php?op=back&id='.$row['acctid2']);
        
addnav('Gladiator herausfordern','battlearena.php'); // ONE arena for TWO things - if installed ;)
        
addnav('Zum Bahnhofsplatz','village.php');
        
stats($row);
    }
    else if(
$row['acctid1']==$session['user']['acctid'] && $row['turn']==1)
    {
        
stats($row);
        
arenanav($row);
    }
    else if(
$row['acctid1']==$session['user']['acctid'] && $row['turn']==2)
    {
        
stats($row);
        
output('`6Dein Gegner `&'.$row['name2'].'`6 hat seinen Zug noch nicht gemacht.`n`n`0');
        
$text=1;
        
addnav('Gladiator herausfordern','battlearena.php');
        
addnav('Zum Bahnhofsplatz','village.php');
    }
    else if(
$row['acctid2']==$session['user']['acctid'] && $row['turn']==0)
    {
        
output('
            `6Du wurdest von `&'
.$row['name1'].' `6herausgefordert. 
            Wenn du die Herausforderung annimmst, 
            musst du `^'
.$cost.'`6 Gold Stadionsgebühr bezahlen.`n
        '
);
        
addnav('Du wurdest herausgefordert');
        
addnav('Herausforderung annehmen','pvparena.php?op=accept&nospec='.$row['nospecials']);
        
addnav('Feige ablehnen','pvparena.php?op=deny&id='.$row['acctid1']);
    }
    else if(
$row['acctid2']==$session['user']['acctid'] && $row['turn']==1)
    {
        
stats($row);
        
output('`6Dein Gegner `&'.$row['name1'].'`6 hat seinen Zug noch nicht gemacht.`n`n');
        
$text=1;
        
addnav('Gladiator herausfordern','battlearena.php');
        
addnav('Zum Bahnhofsplatz','village.php');
    }
    else if(
$row['acctid2']==$session['user']['acctid'] && $row['turn']==2)
    {
        
stats($row);
        
arenanav($row);
    }
    else
    {
        
$text=1;
        if(
$session['user']['age'] > getsetting('maxagepvp',50)) 
        {
            
output('
                "Stopp!" der Stadionwächter versperrt dir mit seiner Lanze den Weg zur Anmeldung und 
                macht nicht den Eindruck, als wollte er dich vorbeilassen 
                "Geh erstmal die elende BW-Brut ausrotten, bevor du hier deine Zeit mit Kämpfen verschwendest!"`n
            '
);
            
addnav('Zum Bahnhofsplatz','village.php');
            
page_footer();
        }
        else 
        {
            
addnav('Spieler herausfordern','pvparena.php?op=challenge');
            
addnav('Gladiator herausfordern','battlearena.php');
            
addnav('Stier herausfordern','bullfight.php');
        }

        
addnav('Zum Bahnhofsplatz','village.php');
    }
    if(
$text==1)
    {
        
checkday();
        
addnav('Aktualisieren','pvparena.php');
        
$str_output .= '
            `c`b`6Das Stadion`0`b`c
            `n`6Du betrittst das große Kampfstadion in der Nähe der Kampfschule. 
            Hier kämpfen einige der Kämpfer gegeneinander und üben sich in ihren besonderen Fertigkeiten, 
            um herauszufinden, wer von ihnen der Beste ist.`nEs geht um die Ehre 
            und um eine gute Platzierung in der Kämpferliga!`n
        '
;
        
$sql "
            SELECT 
                * 
            FROM 
                `pvp` 
            WHERE 
                `acctid1`     > '0'    AND 
                `acctid2`     > '0'    AND 
                `turn`        > '0'
        "
;
        
$result db_query($sql);

        if(
$access_control->su_check(access_control::SU_RIGHT_EDITORUSER))
        {
            
$del true;
        }
        else
        {
            
$del false;
        }

        
$max db_num_rows($result);
        if(
$max)
        {
            
$str_output .= "
                Du beobachtest das bunte Treiben auf dem Platz eine Weile.`n
                Folgende Kämpfer kämpfen gerade gegeneinander:`n
                `n`0
                `c<table border='0' cellpadding='2' cellspacing='1' bgcolor='#999999' align='center'>
                    <tr class='trhead'>
                        <th>Herausforderer</th>
                        <th>Verteidiger</th>
                        <th>Stand (LP)</th>
                        "
.($del?"<th>Ops</th>":"")."
                    </tr>
            "
;
            for(
$i=0;$i<$max;$i++)
            {
                
$row db_fetch_assoc($result);
                
$str_output .= '
                    <tr class="'
.($i%2?'trlight':'trdark').'">
                        <td>
                            '
.$row['name1'].'
                        </td>
                        <td>
                            '
.$row['name2'].'
                        </td>
                        <td align="center">
                            '
.$row['hp1'].' : '.$row['hp2'].'
                        </td>
                        '
.($del?
                            
'<td>
                                <a href="pvparena.php?op=del&amp;kid1='
.$row['acctid1'].'&amp;kid2='.$row['acctid2'].'">Löschen</a>
                            </td>'
                            
:
                            
''
                        
).'
                    </tr>'
;
                if(
$deladdnav('','pvparena.php?op=del&kid1='.$row['acctid1'].'&kid2='.$row['acctid2']);
            }
            
$str_output .= '</table>`c`n`n';
        }
        else
        {
            
$str_output .= '`n`n`6Momentan kämpft hier niemand.`n`n';
        }
        
output($str_output);
        unset(
$str_output);
        
viewcommentary('pvparena','Rufen:',10,'ruft');
        
$str_output '';
        
$str_output .= '`n`n';
        
$result2 db_query("
            SELECT 
                `newsdate`,
                `newstext` 
            FROM 
                `news` 
            WHERE 
                `newstext`    LIKE '%Stadion`6!' 
            ORDER BY 
                `newsid`    DESC 
            LIMIT 
                10
        "
);
        
//for ($i=0;$i<db_num_rows($result2);$i++)
        
while($row2 db_fetch_assoc($result2))
        {
            
$str_output .= '`n`0'.$row2['newsdate'].': '.$row2['newstext'];
        }
        
output($str_output);
        unset(
$str_output);
    }
}

page_footer();

// this is not the end ;)
?>
0.9.7(Dragonslayer Edition V/3)