最新最全最权威的各类手游,端游,页游游戏信息开服信息,尽在游民之家. 订阅微信

修复烈焰王城战可重复提交的BUG

发表时间:2015-03-27 09:46点击人气:责任编辑:admin
王城战NPC脚本如下

function ontalk2094(npc,event,player)
 player:echo(0,npc:GetLowGUID(),[[

  你好,我是皇城战管理员

  申请皇城战

  查看皇城战时间

  购买投石车攻击雕像
]]);
end

function ontalk2094_1(npc,event,player)
 if g_has_war() == 0 then
  if g_get_day() >= 1 then
   if player:get_guild() == 2 then
    if player:num_item(10081) >= 1 then
     player:remove_item(10081,1);
     player:apply_war();
     player:alert(4,0,0,"玩家["..player:GetName().."]提交[攻城令牌]申请攻城战,攻城战将在明天晚上20:00-22:00进行,请各行会做好准备");
     g_alert("玩家["..player:GetName().."]提交[攻城令牌]申请攻城战,攻城战将在明天晚上20:00-22:00进行,请各行会做好准备",2,1000,0,1);
    else
     player:alert(10,0,0,"申请攻城战,需要攻城令牌1个");
    end
   else
    player:alert(10,0,0,"您不是行会老大,不能提交申请");
   end
  else
   player:alert(10,0,0,"新区开服第2天才能申请攻城战");
  end
 else
  player:alert(10,0,0,"明天已经行会申请攻城战了,无需重复申请");
 end
 ontalk2094(npc,0,player,0);
end

function ontalk2094_2(npc,event,player)
 if g_has_war() == 1 or g_has_war() == 3 then
 player:echo(0,npc:GetLowGUID(),[[

  攻城战将会在今天晚上20:00 - 22:00进行

 

 

                                   返回上页
]]);
 return;
 end
 if g_has_war() == 2 then
 player:echo(0,npc:GetLowGUID(),[[

  攻城战将会在明天晚上20:00 - 22:00进行

 

 

                                   返回上页
]]);
 return;
 end
 player:echo(0,npc:GetLowGUID(),[[

  暂时无人申请皇城战

 

 

                                   返回上页
]]);
end

function ontalk2094_3(npc,event,player)
 if player:is_war_time() == true then
  if player:has_defense() == true then
   if g_get_param(1) ~= today() then
    if player:get_gamemoney() >= 1000000 then
     player:sub_gamemoney(1000000);
     g_mon_gen(13,150,145,5205,5205,"投石车",1,0,0);
     player:alert(4,0,0,"攻城方购买了投石车攻击城主雕像,请王城人马速速回城保卫");
     player:alert(19,0,0,"投石车出现在(荒漠王城)150,145");
     g_set_param(1,today());
     return;
    end
    if player:get_gamemoney_bind() >= 1000000 then
     player:sub_gamemoney_bind(1000000);
     g_mon_gen(13,150,145,5205,5205,"投石车",1,0,0);
     player:alert(4,0,0,"攻城方购买了投石车攻击城主雕像,请王城人马速速回城保卫");
     player:alert(19,0,0,"投石车出现在(荒漠王城)150,145");
     g_set_param(1,today());
    else
     player:alert(10,0,0,"购买投石车需要100万金币");
    end
   else
    player:alert(10,0,0,"每次攻城战,只能购买一辆投石车");
   end
  else
   player:alert(10,0,0,"本次攻城战无守城方,无需摧毁城主雕像");
  end
 else
  player:alert(10,0,0,"攻城战开始后,才能购买投石车");
 end
 ontalk2094(npc,0,player,0);
end
  
Npc2094Funid =
{
[1] = ontalk2094_1;
[2] = ontalk2094_2;
[3] = ontalk2094_3;
[0] = ontalk2094;
}  

function CreatureNpcFun(npc,event,player,funid)
 if Npc2094Funid[funid] ~= nil then
  Npc2094Funid[funid](npc,event,player);
 end
end

RegisterUnitEvent(2094,20,"ontalk2094")
RegisterUnitEvent(2094,29,"CreatureNpcFun")