EP2帝国副本分析之进入处理源代码

//Check Item, Level, and Player Count  点击进入帝国事件
bool ImperialFortEvent::CheckCanEnter(int aIndex)
{
 OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
 
 if(gObj->Level >= iMinimalLevel)//判断等级
 {
  if(iInviteCheck == 1)//事件是否开启
  {
   SYSTEMTIME t;
   GetLocalTime(&t);
  
   //Set Map for a day
   if(t.wDayOfWeek == 1 || t.wDayOfWeek == 4)
   {
    iEventMap = 69;
    iEventDay = 1;
   }
   else if(t.wDayOfWeek == 2 || t.wDayOfWeek == 5)
   {
    iEventMap = 70;
    iEventDay = 2;
   }
   else if(t.wDayOfWeek == 3 || t.wDayOfWeek == 6)
   {
    iEventMap = 71;
    iEventDay = 3;
   }
   else if(t.wDayOfWeek == 0)
   {
    iEventMap = 72;
    iEventDay = 4;
   }
   if((gObjGetItemCountInInventory(aIndex,0x1C6D,0) < 1) && iEventDay == 4)//星期天使用完整的赛克罗进入
   {
    //LogFile.outFile("[%s][%s] ImperialFortEvent::CheckCanEnter() - Count(0x1C6D) < 1.",gObj->AccountID,gObj->Name);
   
    //Send Message to client
    Messages.outNormal(aIndex,"[Imperial Fort] Lacking Sekeuromikon to enter!");
    //Send Message box to client
    BYTE Packet[13] = { 0xC1, 0x0D, 0xF7, 0x06, 0x01, 0x07, 0x01, 0x00, 0x31, 0xE0, 0xFD, 0x28, 0x1C } ;
    DataSend(aIndex, &Packet[0], Packet[1]);
    return false;
   }
   if((gObjGetItemCountInInventory(aIndex,0x1C66,0)) < 1)//凯恩的命令书
   {
    //LogFile.outFile("[%s][%s] ImperialFortEvent::CheckCanEnter() - Count(0x1C66) < 1.",gObj->AccountID,gObj->Name);
   
    //Send Message to client
    Messages.outNormal(aIndex,"[Imperial Fort] Lacking ticket to enter!");
    //Send Message box to client
    BYTE Packet[13] = { 0xC1, 0x0D, 0xF7, 0x06, 0x01, 0x07, 0x01, 0x00, 0x31, 0xE0, 0xFD, 0x28, 0x1C } ;
    DataSend(aIndex, &Packet[0], Packet[1]);
    return false;
   }
  }
 
  if(gObj->PartyNumber == -1)//非组队不可进入
  {
   //LogFile.outFile("[%s][%s] ImperialEvent::CheckCanEnter() - Not in Party.",gObj->AccountID,gObj->Name);
  
   //Send Message to client
   Messages.outNormal(aIndex,"[Imperial Fort] Event is only for party!");
   return false;
  }
 
  if(iEventRun == 0)
  {
   if(iEventDay == 4)
   {
    gObjDeleteItemsCount(aIndex,0x1C6D,0,1);//删除物品
   }
   gObjDeleteItemsCount(aIndex,0x1C66,0,1);//删除物品
  
   EventEnter(aIndex);//初始化事件
  }
  else
  {
   Messages.outNormal(aIndex,"[Imperial Fort] Someone is fighting right now.");
  }
 
  //LogFile.outFile("[%s][%s] ImperialEvent::CheckCanEnter() - Run OK.",gObj->AccountID,gObj->Name);
  return true;
 }
 else
 {
  //Error
  //LogFile.outFile("[%s][%s] ImperialEvent::CheckCanEnter() - ERROR.",gObj->AccountID,gObj->Name);
  Messages.outNormal(aIndex,"[Imperial Fort] Your level is to low for event.");
  return false;
 }
}
本文出自 7j45 > 奇迹一条龙