-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathcommand.php
More file actions
1071 lines (1023 loc) · 40.3 KB
/
command.php
File metadata and controls
1071 lines (1023 loc) · 40.3 KB
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
<?php
define('CURSCRIPT', 'game');
require './include/common.inc.php';
//$t_s=getmicrotime();
//require_once GAME_ROOT.'./include/JSON.php';
require GAME_ROOT.'./include/game.func.php';
//判断是否进入游戏
if(!$cuser||!$cpass) { gexit($_ERROR['no_login'],__file__,__line__); }
//$result = $db->query("SELECT * FROM {$tablepre}players WHERE name = '$cuser' AND type = 0");
$pdata = fetch_playerdata_by_name($cuser);
if(!$pdata) { header("Location: valid.php");exit(); }
//$pdata = $db->fetch_array($result);
//判断是否密码错误
if($pdata['pass'] != $cpass) {
$tr = $db->query("SELECT `password` FROM {$gtablepre}users WHERE username='$cuser'");
$tp = $db->fetch_array($tr);
$password = $tp['password'];
if($password == $cpass) {
$db->query("UPDATE {$tablepre}players SET pass='$password' WHERE name='$cuser'");
} else {
gexit($_ERROR['wrong_pw'],__file__,__line__);
}
}
//判断游戏状态和玩家状态,如果符合条件则忽略指令
if($gamestate == 0) {
$gamedata['url'] = 'end.php';
ob_clean();
$jgamedata = compatible_json_encode($gamedata);
echo $jgamedata;
ob_end_flush();
exit();
}
//初始化各变量
$pdata['clbpara'] = get_clbpara($pdata['clbpara']);
extract($pdata,EXTR_REFS);
$log = $cmd = $main = '';
$gamedata = array();
init_playerdata();
//读取玩家互动信息
$result = $db->query("SELECT lid,time,log FROM {$tablepre}log WHERE toid = '$pid' AND prcsd = 0 ORDER BY time,lid");
$llist = '';
while($logtemp = $db->fetch_array($result)){
$log .= date("H:i:s",$logtemp['time']).','.$logtemp['log'].'<br />';
$llist .= $logtemp['lid'].',';
}
if(!empty($llist)){
$llist = '('.substr($llist,0,-1).')';
$db->query("UPDATE {$tablepre}log SET prcsd=1 WHERE toid = '$pid' AND lid IN $llist");
}
//var_dump($_POST);
if($hp > 0){
//显示枪声信息
if(($now <= $noisetime+$noiselimit)&&$noisemode&&($noiseid!=$pid)&&($noiseid2!=$pid)) {
if(($now-$noisetime) < 60) {
$noisesec = $now - $noisetime;
$log .= "<span class=\"yellow\">{$noisesec}秒前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
} else {
$noisemin = floor(($now-$noisetime)/60);
$log .= "<span class=\"yellow\">{$noisemin}分钟前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
}
}
if ($club==0 && !isset($clubavl))
{
include_once GAME_ROOT.'./include/game/clubslct.func.php';
getclub($name,$c1,$c2,$c3);
$clubavl[0]=0; $clubavl[1]=$c1; $clubavl[2]=$c2; $clubavl[3]=$c3;
}
//PORT
//判断背包内道具是否超限
if(strpos($arbsk,'^')!==false && $arbs && $arbe){
global $itmnumlimit;
$itmnumlimit = $arbe>=$arbs ? $arbs : $arbe;
include_once GAME_ROOT.'./include/game/itembag.func.php';
overnumlimit();
}
//判断冷却时间是否过去
if($coldtimeon){
$cdover = $cdsec*1000 + $cdmsec + $cdtime;
$nowmtime = floor(getmicrotime()*1000);
$rmcdtime = $nowmtime >= $cdover ? 0 : $cdover - $nowmtime;
}
//如果身上存在时效性技能,检查技能是否超时
if($hp > 0 && !empty($clbpara['lasttimes'])) check_skilllasttimes($pdata);
//应用眩晕状态效果
if($hp > 0 && !empty($clbpara['skill']) && in_array('inf_dizzy',$clbpara['skill']))
{
$dizzy_times = (($clbpara['starttimes']['inf_dizzy'] + $clbpara['lasttimes']['inf_dizzy']) - $now)*1000;
$log .= '<span class="yellow">你现在处于眩晕状态,什么都做不了!</span><br>眩晕状态持续时间还剩:<span id="timer" class="yellow">'.$dizzy_times.'</span>秒<br><script type="text/javascript">demiSecTimerStarter('.$dizzy_times.');</script>';
goto cd_flag;
}
//执行动作前,身上存在追击标记时,直接进入追击判定
if(!empty($action) && in_array($action,Array('chase','pchase','dfight','cover')) && $mode !== 'revcombat')
{
$command = $action;
goto chase_flag;
}
//执行动作前检查是否有无法跳过且未阅览过的对话框
if(!empty($clbpara['noskip_dialogue']) && strpos($command,'end_dialogue')===false)
{
$opendialog = $clbpara['noskip_dialogue'];
if(!empty($clbpara['dialogue'])) $dialogue_id = $clbpara['dialogue'];
}elseif($coldtimeon && $rmcdtime > 0 && (strpos($command,'move')===0 || strpos($command,'search')===0 || (strpos($command,'itm')===0)&&($command != 'itemget') || strpos($sp_cmd,'sp_weapon')===0 || strpos($command,'song')===0)){
$log .= '<span class="yellow">冷却时间尚未结束!</span><br>';
cd_flag:
$mode = 'command';
}else{
//进入指令判断
if(!empty($itemindex))
{
$opendialog = 'itemmix_tips';
$mode = 'command';
$command = 'itemmain';
$itemcmd = 'itemmix';
}
if(!empty($action))
{
if($action == 'tpmove')
{
$mode = 'command';
$command = 'search';
}
if($action != 'chase' && $action != 'dfight' && $mode !== 'combat' && $mode !== 'revcombat' && $mode !== 'corpse' && $action != 'pacorpse' && $mode !== 'senditem'){
$action = ''; $bid = 0;
}
}
if($command == 'menu') {
$mode = 'command';
//$action = '';
} elseif($mode == 'command') {
if(!empty($itms0) && !in_array($command, Array('itemget','itm0','dropitm0','split_itm'))){//手里拿着道具的时候否决一切其他命令,防止道具被覆盖!
$log .= "你的双手都已经抓满了东西。为了完成所想,你集中意念召唤幻肢……<br>什么都没有发生,除了你的脑壳痛了起来。<br><br>";
$mode = 'command';
} elseif($command == 'move') {
include_once GAME_ROOT.'./include/game/search.func.php';
move($moveto);
if($coldtimeon){$cmdcdtime=$movecoldtime;}
} elseif($command == 'search') {
include_once GAME_ROOT.'./include/game/search.func.php';
search();
if($coldtimeon){$cmdcdtime=$searchcoldtime;}
} elseif(strpos($command,'itm') === 0) {
include_once GAME_ROOT.'./include/game/item.func.php';
$item = substr($command,3);
itemuse($item);
if($coldtimeon){$cmdcdtime=$itemusecoldtime;}
} elseif(strpos($command,'rest') === 0) {
if($command=='rest3' && !in_array($pls,$hospitals)){
$log .= '<span class="yellow">你所在的位置并非医院,不能静养!</span><br>';
}else{
$state = substr($command,4,1);
$mode = 'rest';
}
} elseif($command == 'fishing') {
include_once GAME_ROOT.'./include/game/fishing.func.php';
start_fishing($pdata);
if($mode == 'fishing') {
// 如果成功开始钓鱼,同时应用休息效果
include_once GAME_ROOT.'./include/state.func.php';
rest('rest', $pdata);
}
} elseif($command == 'itemmain') {
if(($club == 20 && $itemcmd == 'itemmix') || ($club != 20 && ($itemcmd == 'elementmix' || $itemcmd == 'elementbag'))){
$log .= "你的手突然掐住了你的头左右摇摆!<br><span class='yellow'>“你还想要干什么,啊?你还想要干什么!!”</span><br>看来你的手和脑子之间起了一点小摩擦。<br><br>";
$mode = 'command';
} else {
if($itemcmd == 'itemmix' || $itemcmd == 'elementmix'){
$main = 'itemmix_tips';
}
if($club == 20){
include_once GAME_ROOT.'./include/game/elementmix.calc.php';
$emax = emix_calc_maxenum();
if($clbstatusa)
{
$log .= "你习惯性摸了摸腰间,但那里已经没有元素口袋了……呼,至少元素们还没有离开你。<br>";
$main = ''; $itemcmd = 'command';
}
}
$mode = $itemcmd;
}
} elseif($command == 'song') {
$sname=trim(trim($art,'【'),'】');
include_once GAME_ROOT.'./include/game/song.inc.php';
//$log.=$sname;
sing($sname);
}elseif($command == 'special') {
if($sp_cmd == 'sp_word'){
include_once GAME_ROOT.'./include/game/special.func.php';
getword();
$mode = $sp_cmd;
}elseif($sp_cmd == 'sp_adtsk'){
include_once GAME_ROOT.'./include/game/special.func.php';
adtsk();
$mode = 'command';
}elseif($sp_cmd == 'sp_trapadtsk'){
$position = 0;
if ($club==7)
{
foreach(Array(1,2,3,4,5,6) as $imn)
if(strpos(${'itmk'.$imn},'B')===0 && ${'itme'.$imn} > 0 ){
$position = $imn;
break;
}
if (!$position)
{
$log .= '<span class="red">你没有电池,无法改造陷阱!</span><br />';
$mode = 'command';
}
}
else if ($club==8)
{
foreach(Array(1,2,3,4,5,6) as $imn)
if(${'itm'.$imn} == '毒药' && ${'itmk'.$imn} == 'Y' && ${'itme'.$imn} > 0 ){
$position = $imn;
break;
}
if (!$position)
{
$log .= '<span class="red">你没有毒药,无法改造陷阱!</span><br />';
$mode = 'command';
}
}
else
{
$log .= '<span class="red">你不懂得如何改造陷阱!</span><br />';
$mode = 'command';
}
if ($position)
{
$position = 0;
foreach(Array(1,2,3,4,5,6) as $imn)
if(strpos(${'itmk'.$imn},'T')===0 && ${'itme'.$imn} > 0 ){
$position = $imn;
break;
}
if (!$position)
{
$log .= '<span class="red">你的背包中没有陷阱,无法改造!</span><br />';
$mode = 'command';
}
else $mode = 'sp_trapadtsk';
}
}elseif($sp_cmd == 'sp_trapadtskselected'){
if (!isset($choice) || $choice=='menu')
{
$mode='command';
}
else
{
$choice=(int)$choice;
if ($choice<1 || $choice>6)
$log.='<span class="red">无此物品。</span><br />';
else
{
include_once GAME_ROOT.'./include/game/special.func.php';
trap_adtsk($choice);
}
$mode='command';
}
//码语行人提取
} elseif ($sp_cmd == 'sp_extract_trait') {
$position = 0;
if ($club == 21) {
foreach (array(1, 2, 3, 4, 5, 6) as $imn)
//遍历所有武器装备
if (strpos(${'itmk' . $imn}, 'D') === 0 || strpos(${'itmk' . $imn}, 'W') === 0) {
$position = $imn;
break;
}
if (!$position) {
$log .= '<span class="red">你没有武器或者装备,无法提取要素!</span><br />';
$mode = 'command';
} else $mode = 'sp_extract_trait';
} else {
$log .= '<span class="red">你不懂得如何提取要素!</span><br />';
$mode = 'command';
}
} elseif ($sp_cmd == 'sp_extract_trait_selected') {
if (!isset($choice) || $choice == 'menu') {
$mode = 'command';
} else {
$choice_position = (int)(substr($choice, -1));
//$choice = (int)$choice;
if ($choice_position < 1 || $choice_position > 6)
$log .= '<span class="red">无此物品。</span><br />';
else {
include_once GAME_ROOT . './include/game/club21.func.php';
item_extract_trait($choice, $choice_position);
}
$mode = 'command';
}
//码语行人插入
} elseif ($sp_cmd == 'sp_add_trait') {
$position = 0;
if ($club == 21) {
foreach (array(1, 2, 3, 4, 5, 6) as $imn)
//遍历所有武器装备
if (strpos(${'itmk' . $imn}, '🥚') === 0) {
$position = $imn;
break;
}
if (!$position) {
$log .= '<span class="red">你没有代码片段,无法插入代码片段!</span><br />';
$mode = 'command';
} else $mode = 'sp_add_trait';
} else {
$log .= '<span class="red">你不懂得如何插入代码片段!</span><br />';
$mode = 'command';
}
} elseif ($sp_cmd == 'sp_add_trait_selected') {
if (!isset($choice) || $choice == 'menu') {
$mode = 'command';
} else {
$choice = (int)($choice);
$choice2 = (int)($choice2);
if ($choice < 1 || $choice > 6 || $choice2 < 1 || $choice2 > 6)
$log .= '<span class="red">无此物品。</span><br />';
elseif ($choice == $choice2)
$log .= '<span class="red">你选择了相同的代码片段。</span><br />';
else {
include_once GAME_ROOT . './include/game/club21.func.php';
item_add_trait($choice, $choice2);
}
$mode = 'command';
}
//码语行人吃饭
} elseif ($sp_cmd == 'sp_consume_trait') {
$position = 0;
if ($club == 21) {
foreach (array(1, 2, 3, 4, 5, 6) as $imn)
//遍历所有道具
if (strpos(${'itmk' . $imn}, '🥚') === 0) {
$position = $imn;
break;
}
if (!$position) {
$log .= '<span class="red">你没有代码片段,无法消耗代码片段!</span><br />';
$mode = 'command';
} else $mode = 'sp_consume_trait';
} else {
$log .= '<span class="red">你不懂得如何消耗代码片段!</span><br />';
$mode = 'command';
}
} elseif ($sp_cmd == 'sp_consume_trait_selected') {
if (!isset($choice) || $choice == 'menu') {
$mode = 'command';
} else {
$choice = (int)($choice);
if ($choice < 1 || $choice > 6 )
$log .= '<span class="red">无此物品。</span><br />';
else {
include_once GAME_ROOT . './include/game/club21.func.php';
consume_trait($choice);
}
$mode = 'command';
}
}elseif($sp_cmd == 'sp_pbomb'){
$mode = 'sp_pbomb';
}elseif($sp_cmd == 'sp_weapon'){
include_once GAME_ROOT.'./include/game/special.func.php';
weaponswap();
$mode = 'command';
if($coldtimeon){$cmdcdtime=$weaponswapcoldtime;}
}elseif($sp_cmd == 'oneonone'){
$mode='oneonone';
}elseif($sp_cmd == 'sp_skpts'){
include_once GAME_ROOT.'./include/game/clubskills.func.php';
calcskills($skarr);
$p12[1]=1; $p12[2]=2;
$mode='sp_skpts';
//妙手技能
}elseif($sp_cmd == 'sp_pickpocket_selected'){
if (!isset($choice)) {
$mode = 'command';
} else {
$choice = (int)($choice);
include_once GAME_ROOT . './include/game/revclubskills_extra.func.php';
skill_tl_pickpocket_act($choice);
}
$mode = 'command';
}elseif($sp_cmd == 'sp_fireseed_deploy' && $club == 22){
include_once GAME_ROOT.'./include/game/club22.func.php';
if(isset($fireseed_id) && isset($deploy_mode)){
$deploy_pls = isset($deploy_pls) ? intval($deploy_pls) : $pls;
$log .= "<span class='yellow'>DEBUG: 部署位置 $deploy_pls</span><br>";
FireseedDeploy($fireseed_id, $deploy_mode, $deploy_pls);
}else{
$log .= '<span class="red">请选择要部署的种火和部署模式!</span><br>';
}
$mode = 'command';
}elseif($sp_cmd == 'sp_fireseed_getitem' && $club == 22){
include_once GAME_ROOT.'./include/game/club22.func.php';
if(isset($fireseed_item_id) && isset($item_id)){
// 从种火物品池中获取物品
if(isset($clbpara['fireseed'][$fireseed_item_id]['items'][$item_id])){
$item = $clbpara['fireseed'][$fireseed_item_id]['items'][$item_id];
// 检查itm0是否为空
if(empty($itm0)){
// 将物品放入itm0(发现物品栏位)
$itm0 = $item['itm'];
$itmk0 = $item['itmk'];
$itme0 = $item['itme'];
$itms0 = $item['itms'];
$itmsk0 = $item['itmsk'];
$itmpara0 = isset($item['itmpara']) ? $item['itmpara'] : '';
// 从种火物品池中移除物品
unset($clbpara['fireseed'][$fireseed_item_id]['items'][$item_id]);
$log .= '<span class="lime">你从种火「'.$clbpara['fireseed'][$fireseed_item_id]['name'].'」处取回了探索到的物品!</span><br>';
// 调用itemfind函数触发物品发现流程
include_once GAME_ROOT.'./include/game/itemmain.func.php';
itemfind($pdata);
}else{
// itm0已被占用,将物品放入地图并添加到玩家视野
$db->query("INSERT INTO {$tablepre}mapitem (itm, itmk, itme, itms, itmsk, itmpara, pls) VALUES ('{$item['itm']}', '{$item['itmk']}', '{$item['itme']}', '{$item['itms']}', '{$item['itmsk']}', '".addslashes(isset($item['itmpara']) ? $item['itmpara'] : '')."', '$pls')");
$new_item_id = $db->insert_id();
// 从种火物品池中移除物品
unset($clbpara['fireseed'][$fireseed_item_id]['items'][$item_id]);
// 将物品添加到玩家视野
include_once GAME_ROOT.'./include/game.func.php';
check_add_searchmemory($new_item_id, 'itm', $item['itm'], $pdata);
// 保存更新后的clbpara数据到数据库
$encoded_clbpara = json_encode($clbpara, JSON_UNESCAPED_UNICODE);
$db->query("UPDATE {$tablepre}players SET clbpara='$encoded_clbpara' WHERE pid='$pid'");
$log .= '<span class="lime">你从种火「'.$clbpara['fireseed'][$fireseed_item_id]['name'].'」处取回了探索到的物品「'.$item['itm'].'」!</span><br>';
$log .= '<span class="yellow">由于你的双手已经拿着其他物品,取回的物品出现在了你的视野中。</span><br>';
$mode = 'command';
}
}else{
$log .= '<span class="red">指定的物品不存在!</span><br>';
$mode = 'command';
}
}else{
$log .= '<span class="red">请选择要获取物品的种火和物品!</span><br>';
$mode = 'command';
}
}elseif($sp_cmd == 'sp_fireseed_enhance' && $club == 22){
include_once GAME_ROOT.'./include/game/club22.func.php';
if(isset($enhance_fireseed_id) && isset($enhance_item)){
$enhance_result = FireseedEnhance($enhance_fireseed_id, $enhance_item);
if($enhance_result) {
// 添加侧边栏刷新标记,确保侧边栏能够实时更新
$log .= "<span id='HsUipfcGhU'></span>";
$log .= '<span class="lime">种火强化成功!</span><br>';
$mode = 'command';
}
}else{
$log .= '<span class="red">请选择要强化的种火和焰火物品!</span><br>';
}
$mode = 'command';
}elseif($sp_cmd == 'sp_save_fireseed_select' && $club == 22){
// 保存种火选择状态到clbpara
if(isset($select_type) && isset($fireseed_id)){
if(!isset($clbpara['fireseed_ui_state'])) {
$clbpara['fireseed_ui_state'] = array();
}
$clbpara['fireseed_ui_state'][$select_type] = $fireseed_id;
// 保存到数据库
$encoded_clbpara = json_encode($clbpara, JSON_UNESCAPED_UNICODE);
$db->query("UPDATE {$tablepre}players SET clbpara='$encoded_clbpara' WHERE pid='$pid'");
$log .= "<!-- 种火选择状态已保存: {$select_type} = {$fireseed_id} -->";
}
$mode = 'command';
}else{
$mode = $sp_cmd;
}
} elseif($command == 'team') {
include_once GAME_ROOT.'./include/game/team.func.php';
if($teamcmd == 'teamquit') {
teamquit();
} else{
teamcheck();
}
} elseif(strpos($command,'consle') === 0) {
if(isset($clbpara['console']))
{
$cls_cmd = substr($command,7);
include_once GAME_ROOT.'./include/game/console.func.php';
if($cls_cmd == 'wthchange'){console_wthchange($cwth);}
elseif($cls_cmd == 'dbutton'){console_dbutton();}
elseif($cls_cmd == 'radar'){
include_once GAME_ROOT.'./include/game/item2.func.php';
newradar(2);
}elseif($cls_cmd == 'search'){
$cls_cmd_kind = substr($csc,7);
console_searching($cls_cmd_kind,$csnm,$cstype);
}elseif(strpos($cls_cmd,'areactrl')===0){
$cls_cmd_kind = substr($cls_cmd,8);
console_areacontrol($cls_cmd_kind);
}
}
else{
$mode='command';
}
} elseif(strpos($command,'dialogue_choice') === 0) {
// 处理对话选择
$choice_parts = explode(' ', $command);
if(count($choice_parts) >= 3) {
$dialogue_id = $choice_parts[1];
$choice_index = $choice_parts[2];
// 检查对话 ID 和选择索引是否有效
if(isset($dialogue_branch[$dialogue_id]) && isset($dialogue_branch[$dialogue_id][$choice_index])) {
// 记录玩家的选择
$clbpara['dialogue_choice'] = array(
'dialogue_id' => $dialogue_id,
'choice_index' => $choice_index,
'choice_text' => $dialogue_branch[$dialogue_id][$choice_index]
);
// 输出选择的结果
$log .= "你选择了:<span class=\"yellow\">{$dialogue_branch[$dialogue_id][$choice_index]}</span><br>";
// 添加非常明显的错误信息
//$log .= "<div style='background-color: red; color: white; padding: 10px; margin: 10px; border: 2px solid black;'>对话选择调试信息: 对话 ID = {$dialogue_id}, 选择索引 = {$choice_index}</div>";
// 如果有对应的选择结果日志,显示它
$choice_log_key = $dialogue_id.'_choice_'.$choice_index;
// 调试信息,显示对话日志的键值
//$log .= "<!-- DEBUG: 对话 ID: {$dialogue_id}, 选择索引: {$choice_index}, 选择日志键: {$choice_log_key} -->";
// 显示所有可用的对话日志键
//$log .= "<!-- DEBUG: 可用的对话日志键: ";
//foreach($dialogue_log as $key => $value) {
// $log .= "{$key}, ";
//}
//$log .= " -->";
if(isset($dialogue_log[$choice_log_key]) && !empty($dialogue_log[$choice_log_key])) {
//$log .= "<!-- DEBUG: 使用选择特定日志 -->";
$log .= $dialogue_log[$choice_log_key];
} elseif(isset($dialogue_log[$dialogue_id]) && !empty($dialogue_log[$dialogue_id])) {
// 如果没有特定选择的日志,显示通用日志
//$log .= "<!-- DEBUG: 使用通用日志 -->";
$log .= $dialogue_log[$dialogue_id];
} else {
$log .= "<!-- DEBUG: 没有找到对应的对话日志 -->";
}
// 清除对话状态
unset($clbpara['dialogue']);
unset($clbpara['noskip_dialogue']);
// 确保对话框不会重新打开
$dialogue_id = null;
$opendialog = null;
// 保存玩家数据,确保选择被记录
//$serialized_clbpara = serialize($clbpara);
$encoded_clbpara = json_encode($clbpara, JSON_UNESCAPED_UNICODE);
//$log .= "<!-- DEBUG: 序列化后的 clbpara 长度: " . strlen($serialized_clbpara) . " -->";
//$log .= "<!-- DEBUG: 编码后的 clbpara 长度: " . strlen($encoded_clbpara) . " -->";
$update_query = "UPDATE {$tablepre}players SET clbpara='" . $encoded_clbpara . "' WHERE pid='$pid'";
$update_result = $db->query($update_query);
if($update_result) {
$log .= "<!-- DEBUG: 数据库更新成功 -->";
} else {
$log .= "<!-- DEBUG: 数据库更新失败: " . $db->error() . " -->";
}
// 设置命令模式为命令模式,确保页面能够正确显示选择结果
$mode = 'command';
} else {
$log .= "<span class=\"red\">无效的对话选择!</span><br>";
}
} else {
$log .= "<span class=\"red\">对话选择格式错误!</span><br>";
}
} elseif(strpos($command,'end_dialogue') === 0) {
//$log.="【DEBUG】关闭了对话框。";
if(!empty($dialogue_log[$clbpara['dialogue']])) $log.= $dialogue_log[$clbpara['dialogue']];
unset($clbpara['dialogue']); unset($clbpara['noskip_dialogue']);
} elseif ($command == 'choose_fish') {
// 处理鱼篓子物品选择
if (isset($clbpara['fish_basket'])) {
include_once GAME_ROOT.'./include/game/item.nouveau_booster1.php';
item_nouveau_booster1($clbpara['fish_basket']['position'], $pdata);
} else {
$log .= '出现了错误,请重新使用鱼篓子。<br>';
$mode = 'command';
}
} elseif (strpos($command,'memory')===0) {
$smn = substr($command,6);
if(!empty($clbpara['smeo'] && isset($clbpara['smeo'][$smn]))){
$iid = $clbpara['smeo'][$smn][0]; $itp = $clbpara['smeo'][$smn][1];
lost_searchmemory($smn,$pdata);
if($itp == 'itm'){
include_once GAME_ROOT.'./include/game/search.func.php';
focus_item($pdata,$iid);
}else{
$action = 'focus'; $bid = $iid; $command = 'focus';
goto chase_flag;
}
}
}
} elseif($mode == 'item') {
include_once GAME_ROOT.'./include/game/item2.func.php';
$item = substr($command,3);
use_func_item($usemode,$item);
} elseif($mode == 'itemmain') {
include_once GAME_ROOT.'./include/game/itemmain.func.php';
if($command == 'itemget') {
itemget();
} elseif($command == 'itemadd') {
itemadd();
} elseif($command == 'itemmerge') {
if($merge2 == 'n'){itemadd();}
else{itemmerge($merge1,$merge2);}
} elseif($command == 'itemmove') {
itemmove($from,$to);
} elseif(strpos($command,'split_itm') === 0) {
$split_item = substr($command,9);
include_once GAME_ROOT . './include/game/elementmix.func.php';
split_item_to_elements($split_item);
} elseif(strpos($command,'drop') === 0) {
$drop_item = substr($command,4);
itemdrop($drop_item);
} elseif(strpos($command,'off') === 0) {
$off_item = substr($command,3);
itemoff($off_item);
//itemadd();
} elseif(strpos($command,'swap') === 0) {
$swap_item = substr($command,4);
itemdrop($swap_item);
itemadd();
} elseif($command == 'itemmix') {
if (isset($itemselect) && $itemselect==999)
$mode='command';
else
{
$mixlist = array();
if (!isset($mixmask))
{
for($i=1;$i<=6;$i++)
if(isset(${'mitm'.$i}) && ${'mitm'.$i} == $i)
$mixlist[] = $i;
}
else
{
for($i=1;$i<=6;$i++)
if ($mixmask&(1<<($i-1)))
$mixlist[] = $i;
}
include_once GAME_ROOT.'./include/game/itemmix.func.php';
if (isset($itemselect))
itemmix_rev($mixlist,$itemselect);
else itemmix_rev($mixlist);
}
} elseif($command == 'elementmix') {
include_once GAME_ROOT.'./include/game/elementmix.func.php';
$itmemax = $change_emax ? (int)$emixitmemax : 100;
$itmer = $change_emr ? (int)$emixitmer : 55;
elements_mix_prepare($emixlist,$emixnums,$itmemax,$itmer);
$mode='command';
} elseif($command == 'itemencase') {
if(strpos($arbsk,'^')!==false && $arbs && $arbe){
$ilist = array();
for($i=1;$i<=6;$i++){
if(isset(${'mitm'.$i}) && ${'mitm'.$i} == $i){
$ilist[] = $i;
}
}
item_encase($ilist);
}else{
$log.="<span class='red'>你身上没有背包,或是没有将背包装备上!<br>";
}
} elseif($command == 'iteminfo') {
if(strpos($arbsk,'^')!==false && $arbs && $arbe){
item_info();
}else{
$log.="<span class='red'>你身上没有背包,或是没有将背包装备上!<br>";
}
} elseif(strpos($command,'usebagitm') !==false) {
if(strpos($arbsk,'^')!==false && $arbs && $arbe){
$itemid = substr($command,10);
item_out($itemid);
}else{
$log.="<span class='red'>你身上没有背包,或是没有将背包装备上!<br>";
}
} elseif(strpos($command,'changewep') !==false) {
include_once GAME_ROOT.'./include/game/itemmain.func.php';
change_subwep();
$mode = 'command';
}
} elseif($mode == 'special') {
include_once GAME_ROOT.'./include/game/special.func.php';
if(strpos($command,'pose') === 0) {
$cpose = substr($command,4,1);
if(in_array($cpose,$apose)){
$pose = $cpose;
$log .= "基础姿态变为<span class=\"yellow\">$poseinfo[$pose]</span>。<br> ";
$mode = 'command';
}else{
$log .= "<span class=\"yellow\">这个姿势太奇怪了!</span><br> ";
$mode = 'command';
}
} elseif(strpos($command,'tac') === 0) {
$ctac = substr($command,3,1);
if(in_array($ctac,$atac)){
$tactic = $ctac;
$log .= "应战策略变为<span class=\"yellow\">$tacinfo[$tactic]</span>。<br> ";
$mode = 'command';
}else{
$log .= "<span class=\"yellow\">这种策略太奇怪了!</span><br> ";
$mode = 'command';
}
} elseif(strpos($command,'hor') === 0) {
$chor = substr($command,3,1);
if(isset($horizoninfo[$chor])){
$horizon = $chor;
$log .= "视界切换为<span class=\"yellow\">$horizoninfo[$chor]</span>。<br> ";
# 切换视界后,丢失所有视野
lost_searchmemory('all',$pdata);
# 向页面发送刷新标记
$log .= "<span id='HsUipfcGhU'></span>";
}else{
$log .= "<span class=\"yellow\">这种想法太奇怪了!</span><br> ";
}
$mode = 'command';
} elseif(strpos($command,'inf') === 0) {
$infpos = substr($command,3,1);
chginf($infpos);
} elseif(strpos($command,'chkp') === 0) {
$itmn = substr($command,4,1);
chkpoison($itmn);
} elseif(strpos($command,'shop') === 0) {
$shop = substr($command,4,2);
shoplist($shop);
} elseif(strpos($command,'clubsel') === 0) {
# 后续更新中,将停用在游戏内直接选择称号的方式
$clubchosen = (int)str_replace('clubsel','',$command);
include_once GAME_ROOT.'./include/game/clubslct.func.php';
$retval=selectclub($clubchosen);
if ($retval==0)
$log.="称号选择成功。<br>";
else if ($retval==1)
$log.="称号选择失败,称号一旦被选择便无法更改。<br>";
else if ($retval==2)
$log.="未选择称号。<br>";
else $log.="称号选择非法!<br>";
$mode = 'command';
}
} elseif($mode == 'senditem') {
include_once GAME_ROOT.'./include/game/battle.func.php';
senditem();
} elseif($mode == 'combat') {
include_once GAME_ROOT.'./include/game/combat.func.php';
combat(1,$command);
} elseif($mode == 'revcombat'){
chase_flag:
include_once GAME_ROOT.'./include/game/revbattle.func.php';
if(!isset($message)) $message = '';
\revbattle\revbattle_prepare($command,$message);
} elseif($mode == 'rest') {
include_once GAME_ROOT.'./include/state.func.php';
// 如果在休息状态下点击钓鱼按钮,则进入钓鱼状态
if($command == 'fishing') {
include_once GAME_ROOT.'./include/game/fishing.func.php';
start_fishing($pdata);
// 如果成功进入钓鱼状态,保持原有的休息状态
if($mode == 'fishing') {
// 不需要调用rest函数,因为钓鱼状态下会自动应用休息效果
}
} else {
rest($command);
}
} elseif($mode == 'fishing') {
include_once GAME_ROOT.'./include/game/fishing.func.php';
fishing_command($command, $pdata);
// 在钓鱼的同时也应用休息效果
include_once GAME_ROOT.'./include/state.func.php';
rest($command, $pdata);
// } elseif($mode == 'chgpassword') {
// include_once GAME_ROOT.'./include/game/special.func.php';
// chgpassword($oldpswd,$newpswd,$newpswd2);
// } elseif($mode == 'chgword') {
// include_once GAME_ROOT.'./include/game/special.func.php';
// chgword($newmotto,$newlastword,$newkillmsg);
} elseif($mode == 'corpse') {
if($command == 'fireseed_recruit' && $club == 22) {
include_once GAME_ROOT.'./include/game/club22.func.php';
$result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='$bid' AND hp=0");
if($db->num_rows($result) > 0) {
$npc = $db->fetch_array($result);
FireseedRecruit($npc);
}
$mode = 'command';
} else {
include_once GAME_ROOT.'./include/game/itemmain.func.php';
getcorpse($command);
}
} elseif($mode == 'team') {
include_once GAME_ROOT.'./include/game/team.func.php';
if ($command=="teammake") teammake($nteamID,$nteamPass,(int)$ticon);
if ($command=="teamjoin") teamjoin($nteamID,$nteamPass);
if ($command=="teamquit") teamquit($nteamID,$nteamPass);
} elseif($mode == 'shop') {
if(in_array($pls,$shops) || !check_skill_unlock('c11_ebuy',$pdata)){
if($command == 'shop') {
$mode = 'sp_shop';
} else {
include_once GAME_ROOT.'./include/game/itemmain.func.php';
itembuy($command,$shoptype,$buynum);
}
}else{
$log .= '<span class="yellow">你所在的地区没有商店。</span><br />';
$mode = 'command';
}
} elseif($mode == 'depot') {
include_once GAME_ROOT.'./include/game/depot.func.php';
if(in_array($pls,$depots))
{
$saveitem_list = depot_getlist($name,$type);
switch($command)
{
case 'sp_depot_save':
$mode = 'sp_depot_save';
break;
case 'sp_depot_load':
$mode = 'sp_depot_load';
break;
case strpos($command,'saveitem')===0:
$iid = substr($command,9);
depot_save($iid);
break;
case strpos($command,'loaditem')===0:
$lid = substr($command,9);
depot_load($lid);
break;
default :
$mode = 'sp_depot';
}
}
else
{
$log .= '<span class="yellow">你所在的地区没有安全箱。</span><br />';
$mode = 'command';
}
} elseif($mode == 'deathnote') {
if($dnname){
include_once GAME_ROOT.'./include/game/item2.func.php';
deathnote($name,$item,$dnname,$dndeath,$dngender,$dnicon);
} else {
$log .= '嗯,暂时还不想杀人。<br>你合上了■DeathNote■。<br>';
$mode = 'command';
}
}elseif($mode == 'oneonone') {
if($dnname){
include_once GAME_ROOT.'./include/game/special.func.php';
oneonone($dnname,$name);
} else {
$log .= '约战取消。<br>';
$mode = 'command';
}
} elseif ($mode == 'sp_skpts') {
//include_once GAME_ROOT.'./include/game/clubskills.func.php';
//upgradeclubskills($command);
//calcskills($skarr);
//$p12[1]=1; $p12[2]=2;
$log .= "不存在该指令!<br>";
$mode = 'command';
} elseif ($mode == 'revskpts') {
$sk = substr($command,9);
if(isset($cskills[$sk])) {
if(strpos($command,'upgskill_')!==false) {
if(isset($cskills[$sk]['num_input'])){
$nums = isset(${$command.'_nums'}) ? (int)${$command.'_nums'} : 1;
upgclbskills($sk,$nums);
}else{
upgclbskills($sk);
}
} elseif(strpos($command,'swtskill_')!==false) {
if(isset(${$sk.'upgpara'}) && isset($cskills[$sk]['choice']) && in_array(${$sk.'upgpara'},$cskills[$sk]['choice'])) {
switchclbskills($sk,${$sk.'upgpara'});
}
} elseif(strpos($command,'actskill_')!==false) {
# 其他特殊技能按钮
include_once GAME_ROOT.'./include/game/revclubskills_extra.func.php';
if($sk == 'c4_roar' || $sk == 'c4_sniper'){skill_c4_unlock($sk);}
elseif($sk == 'c11_merc'){
if(isset(${$sk.'mkey'}) && isset(${$sk.'fire'}) && ${$sk.'fire'} == ${$sk.'mkey'}){
skill_merc_fire($sk,${$sk.'mkey'});
} elseif(isset(${$sk.'mkey'}) && isset(${$sk.'chase'})){
skill_merc_chase($sk,${$sk.'mkey'});
} elseif(isset(${$sk.'mkey'}) && isset(${$sk.${$sk.'mkey'}.'moveto'})){
skill_merc_move($sk,${$sk.'mkey'},${$sk.${$sk.'mkey'}.'moveto'});
}
}
}
}
$mode = 'command';
} elseif ($mode == 'sp_pbomb') {
include_once GAME_ROOT.'./include/game/special.func.php';
if ($command=="YES") press_bomb();
$mode = 'command';
} else {
command_end_flag:
$mode = 'command';
}
if($action == 'pacorpse' && $gamestate < 40){
// if($state == 1 || $state == 2 || $state ==3){
// $state = 0;
// }
$cid = $bid;
if($cid){
$result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='$cid' AND hp=0");
if($db->num_rows($result)>0){
$edata = $db->fetch_array($result);
include_once GAME_ROOT.'./include/game/battle.func.php';
findcorpse($edata);
}
}
}
//指令执行完毕,更新冷却时间
if($coldtimeon && isset($cmdcdtime)){
$nowmtime = floor(getmicrotime()*1000);
$cdsec = floor($nowmtime/1000);
$cdmsec = fmod($nowmtime , 1000);
$cdtime = $cmdcdtime;
//$psdata = Array('pid' => $pid, 'cdsec' => $cdsec, 'cdmsec' => $cdmsec, 'cdtime' => $cdtime, 'cmd' => $mode);
//set_pstate($psdata);
$rmcdtime = $cmdcdtime;
}
//读取背包内道具
if(strpos($arbsk,'^')!==false && $arbs && $arbe){
include_once GAME_ROOT.'./include/game/itembag.func.php';
$itemlist = item_arr();
}
$endtime = $now;
$cmdnum ++;
}
//检查是否需要重生成播放器
$bgm_player = init_bgm();
if(!empty($bgm_player))
{
$gamedata['innerHTML']['ingamebgm'] = $bgm_player;
}
//检查执行动作后是否有对话框产生
//如果刚刚处理了对话选择,则不显示对话框
$just_made_choice = strpos($command, 'dialogue_choice') === 0;
if(!$just_made_choice && !empty($clbpara['dialogue']))
{
$opendialog = 'dialogue';
$dialogue_id = $clbpara['dialogue'];
}
//显示指令执行结果
$gamedata['innerHTML']['notice'] = ob_get_contents();
if(($coldtimeon && $showcoldtimer && $rmcdtime) || isset($dizzy_times)){
$gamedata['timer'] = isset($dizzy_times) ? $dizzy_times : $rmcdtime;
}
if($hp > 0 && $coldtimeon && $showcoldtimer && $rmcdtime){
$log .= "行动冷却时间:<span id=\"timer\" class=\"yellow\">0.0</span>秒<br>";
}
player_save($pdata);
}
init_profile();
if($hp <= 0) {
$dtime = date("Y年m月d日H时i分s秒",$endtime);
$kname='';
if($bid) {
$result = $db->query("SELECT name FROM {$tablepre}players WHERE pid='$bid'");
if($db->num_rows($result)) { $kname = $db->result($result,0); }
}
ob_clean();
include template('death');
$gamedata['innerHTML']['cmd'] = ob_get_contents();
$mode = 'death';
} elseif($cmd){
$gamedata['innerHTML']['cmd'] = $cmd;
} elseif($itms0){