guildId = $guildid; $guildInfo->createts = now(); $guildInfo->members = array(); $guildInfo->level = 1; $guildInfo->cupScore = 0; $guildInfo->applylist = ObjectInit(); $guildInfo->condition = ObjectInit(); $guildInfo->giftnum_record = ObjectInit(); return $guildInfo; } static function CreateNewGuildID($mem, $zoneid) { $i = 0; while (true) { if ($mem->add(MemKey_Guild::constCreateGuildIDLock(), "V")) { $guildid = $mem->get(MemKey_Guild::constGetCurrentMaxGuildID($zoneid)); if ($guildid == null) { $guildid = GUILDIDBASE; } $guildid += 1; $mem->set(MemKey_Guild::constGetCurrentMaxGuildID($zoneid), $guildid); $mem->delete(MemKey_Guild::constCreateGuildIDLock()); return $guildid; } else { if ($i++ > 10) return 0; usleep(13); // 休息13微妙 } } } } /** * 玩家请求加入公会的消息结构体 */ class UserApplyForGuildModel { public $uid; public $ts; public $approved = false; public $name; public $level; /** * 创建一条新的请求信息 * @param type $oid * @return UserApplyForGuildModel Description */ public static function CreateApplyInfo($uid, $name, $level) { $ret = new UserApplyForGuildModel(); $ret->uid = $uid; $ret->ts = now(); $ret->name = $name; $ret->level = $level; $ret->approved = false; return $ret; } } /** * 公会值日消息类型 */ class GuildJournalType { const Join = 1; //加入 const requestDonate = 2; //请求捐献 const Quit = 3; //退会 const ChangeChairMan = 4; //改变会长 const BuyGift = 5; //购买礼包 } /** * 公会日志数据体 */ class GuildJournalModel { public $ts; public $uid; public $type; public $datas; public static function CreateJoin($uid, $name) { $journal = new GuildJournalModel(); $journal->ts = now(); $journal->type = GuildJournalType::Join; $journal->uid = $uid; $journal->datas = array(); $journal->datas [] = $uid; $journal->datas [] = $name; return $journal; } public static function RequestDonate($uid, $name, $cardId, $cardCount) { $journal = new GuildJournalModel(); $journal->ts = now(); $journal->type = GuildJournalType::requestDonate; $journal->uid = $uid; $journal->datas = array(); $journal->datas [] = $uid; $journal->datas [] = $name; $journal->datas [] = $cardId; $journal->datas [] = $cardCount; $journal->datas [] = 0; //现在已得到的捐献数量 return $journal; } public static function CreateQuit($uid, $name) { $journal = new GuildJournalModel(); $journal->ts = now(); $journal->type = GuildJournalType::Quit; $journal->uid = $uid; $journal->datas = array(); $journal->datas [] = $uid; $journal->datas [] = $name; return $journal; } public static function CreateChangeChairman($uid, $name, $transferedid, $transferedname) { $journal = new GuildJournalModel(); $journal->ts = now(); $journal->type = GuildJournalType::ChangeChairMan; $journal->uid = $uid; $journal->datas = array(); $journal->datas [] = $uid; $journal->datas [] = $name; $journal->datas [] = $transferedid; $journal->datas [] = $transferedname; return $journal; } public static function BuyGift($uid, $name) { $journal = new GuildJournalModel(); $journal->ts = now(); $journal->type = GuildJournalType::BuyGift; $journal->uid = $uid; $journal->datas = array(); $journal->datas [] = $uid; $journal->datas [] = $name; return $journal; } } class GuildAnnouncementModel extends Object_ext { public $ts; public $title; public $content; function __construct($tag, $ts, $title, $content) { if (1 == func_num_args() && $tag) { # 默认的Object初始化方法 parent::__construct($tag); } else { $this->ts = $ts; $this->title = $title; $this->content = $content; } } }